Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Curve area as input parameter at every time point

Please login with a confirmed email address before reporting spam

Hi all

I was wondering, is there a way to declare a variable (say v1) that is the integration of another variable(v2) over a certain domain. This would mean that v1 will change during each time step as a result of the integral changing. i appreciate any input from you folks. Thanks

7 Replies Last Post Dec 20, 2011, 3:51 a.m. EST

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jan 21, 2011, 7:02 p.m. EST
I figured it out. Declare an integration coupling operator (intop) over the domain (either line, surface or volume integral). Then declare the expression v1=intop(v2). Now v1 can be used anywhere in the model as just another variable.
I figured it out. Declare an integration coupling operator (intop) over the domain (either line, surface or volume integral). Then declare the expression v1=intop(v2). Now v1 can be used anywhere in the model as just another variable.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Dec 16, 2011, 9:02 a.m. EST
Dear Melissa,
how do you define "intop" and where?

I would also need integrate over a variable to get another one.

I hope you could help me.
thanks in advance,
best regards,
Isa
Dear Melissa, how do you define "intop" and where? I would also need integrate over a variable to get another one. I hope you could help me. thanks in advance, best regards, Isa

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Dec 16, 2011, 3:49 p.m. EST
Hi

I believ you are confused about the local variables and the "global variables". Most local variables are fields they depend on the coordinates, time etc, hence depends on which entity you consider (domain, boundary, edge or point) while a global variable is mostly independt from the coordinates.

So defining a global varable gv = intop1(lv) means that the intop1() (integration operator) is applyig an integration of the local variable such as gv(t)=int_over_selected_entities_of(local_variable(x,y,z,t)*dx*dy*dz (hope you follow my notation ;) The inteop1() is defined uner Definition Coupling variable

the dependence on "t" is optional and might not be relevant for you (except if you run a time solver)

--
Good luck
Ivar
Hi I believ you are confused about the local variables and the "global variables". Most local variables are fields they depend on the coordinates, time etc, hence depends on which entity you consider (domain, boundary, edge or point) while a global variable is mostly independt from the coordinates. So defining a global varable gv = intop1(lv) means that the intop1() (integration operator) is applyig an integration of the local variable such as gv(t)=int_over_selected_entities_of(local_variable(x,y,z,t)*dx*dy*dz (hope you follow my notation ;) The inteop1() is defined uner Definition Coupling variable the dependence on "t" is optional and might not be relevant for you (except if you run a time solver) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Dec 19, 2011, 3:14 a.m. EST
Dear Ivar,

I am afraid I don't understand you very well.

I am using COMSOL 4.2a with the AC/DC module. The problem I want to simulate is Magnetic Field (mf).
If I calculate the variable "mf.Jiphi" and I want to calculate the integration of this variable I do:
Model 1 (mod1) -> Variables 2a and, there, I define "Intplasma=intop1(mf.Jiphi)"

Later, in external Current Density in the domain I want to put a value I would do:
Je=Intplasma/(area of domain);

The study I am using is a time dependent solver but when I want to run the problem, I obtain the following error:

Failed to evaluate variable Jacobian.
- Variable: mod1.Intplasma
- Geometry: 1
- Domain: 5

I don't know what I am doing wronlgy and I would be really grateful if you could help me.

Best,
Isa
Dear Ivar, I am afraid I don't understand you very well. I am using COMSOL 4.2a with the AC/DC module. The problem I want to simulate is Magnetic Field (mf). If I calculate the variable "mf.Jiphi" and I want to calculate the integration of this variable I do: Model 1 (mod1) -> Variables 2a and, there, I define "Intplasma=intop1(mf.Jiphi)" Later, in external Current Density in the domain I want to put a value I would do: Je=Intplasma/(area of domain); The study I am using is a time dependent solver but when I want to run the problem, I obtain the following error: Failed to evaluate variable Jacobian. - Variable: mod1.Intplasma - Geometry: 1 - Domain: 5 I don't know what I am doing wronlgy and I would be really grateful if you could help me. Best, Isa

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Dec 19, 2011, 3:58 a.m. EST
Hi

it's not necessarily wrong ;)
As you define and impose a constant external current Je being the average of another current from the model, and probably use it in the solver process, COMSOL is trying to get its derivative (Jacobian) for the solver process, but COMSOL does not manage to get a derivative from the integration operation.

You could try a Intplasma=nojac(intop1(mf.Jiphi)) but I not at all sure it will do the job, it gives a hint that your function does not have a derivative.

now I need to know more about your model to goany further, even if i'm not sure I can fully answer your case, but perhaps other out there ;)

--
Good luck
Ivar
Hi it's not necessarily wrong ;) As you define and impose a constant external current Je being the average of another current from the model, and probably use it in the solver process, COMSOL is trying to get its derivative (Jacobian) for the solver process, but COMSOL does not manage to get a derivative from the integration operation. You could try a Intplasma=nojac(intop1(mf.Jiphi)) but I not at all sure it will do the job, it gives a hint that your function does not have a derivative. now I need to know more about your model to goany further, even if i'm not sure I can fully answer your case, but perhaps other out there ;) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Dec 19, 2011, 4:17 a.m. EST
Dear Ivar,

I have tried to use Intplasma=nojac(intop1(mf.Jiphi)), but I obtain the same problem.
Here I attach the file .mph in order you could know more about my model to go further.

thanks in advance,
best regards,
Isa
Dear Ivar, I have tried to use Intplasma=nojac(intop1(mf.Jiphi)), but I obtain the same problem. Here I attach the file .mph in order you could know more about my model to go further. thanks in advance, best regards, Isa


Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Dec 20, 2011, 3:51 a.m. EST
Hi

Well you have several issues I see in your model

best is to set up some model variables, or global variables for values you need to calculate (i.e. all "red" parameters) Parameters are static and loaded once at solver start, here several of them are related to values that change during the simulation, so they should NOT be in the parameter definitions

you have a static and a time dfependent solver sequence, but during static solver the time "t" is not defined, it is worth to set a Parameter t=0[s] in the parameter list as you need "t" to solve some of your (to be) variables

Then the External current Jp is not defined on any domain I suspect ist is supposed to apply to "4" or ?

the remove the nojac(), as I suspect there are other reasons for your error.

General remark:
red = formula error, must be re-solved, before solving !
orange = unit issue warning, might not be critical, personally I always try to resolve them, as often its also linked to a typo or a unit conversion error from my side

--
Good luck
Ivar
Hi Well you have several issues I see in your model best is to set up some model variables, or global variables for values you need to calculate (i.e. all "red" parameters) Parameters are static and loaded once at solver start, here several of them are related to values that change during the simulation, so they should NOT be in the parameter definitions you have a static and a time dfependent solver sequence, but during static solver the time "t" is not defined, it is worth to set a Parameter t=0[s] in the parameter list as you need "t" to solve some of your (to be) variables Then the External current Jp is not defined on any domain I suspect ist is supposed to apply to "4" or ? the remove the nojac(), as I suspect there are other reasons for your error. General remark: red = formula error, must be re-solved, before solving ! orange = unit issue warning, might not be critical, personally I always try to resolve them, as often its also linked to a typo or a unit conversion error from my side -- Good luck Ivar

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.