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.

How to define variable regard to time dependent steps?

Please login with a confirmed email address before reporting spam

Hello All
I'm running a time dependent AC/DC model,
The conductivity of material must be changed regards to voltage differences on two coordinate in each step .
I wonder How can I define a variable or parameter which can access the voltage of these two coordinate in each step and change the conductivity of material for next other step?
thanks in advance

4 Replies Last Post 04.05.2013, 07:13 GMT-4
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 27.04.2013, 03:48 GMT-4
Hi

I would say you need to define two global variables under model definition variables, by integrating over points, or better everaging over some boundary. Then you define your conductivity as a function depending on these two variables. Be sure your initial conditions are coherent though

--
Good luck
Ivar
Hi I would say you need to define two global variables under model definition variables, by integrating over points, or better everaging over some boundary. Then you define your conductivity as a function depending on these two variables. Be sure your initial conditions are coherent though -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 27.04.2013, 08:39 GMT-4
Thanks dear Ivar for reply
I did what u suggested to me but still I have problem, Please explain more , I use Comsol version 4.3.
I have defined two variables named “Variables 2a” and “Variables 3a” under model1->definitions. In Variables 2a, Boundary level was chosen and boundary No.8 was selected. Then in Variables name Vup and in Expression field V[V] were inserted. In the same way as “Variables 2a”, “Variables 3a” was configured by selecting boundary No.6, Variable Name by Vdown and Variable Expression V[V].Then I have configured my material as:
In Material1->basic, I have added an Analytic. The Function name in Analytic was changes to my_sigma. I put t as my Argument and I have modified Parameters tables by
Expression= if(abs(Vup-Vdown)>500,1e-4,1e-15)
Arguments=t When I run the study the outcome error is Vup is undefined variable.
Is it possible to know steps?

really appreciate your help
Thanks dear Ivar for reply I did what u suggested to me but still I have problem, Please explain more , I use Comsol version 4.3. I have defined two variables named “Variables 2a” and “Variables 3a” under model1->definitions. In Variables 2a, Boundary level was chosen and boundary No.8 was selected. Then in Variables name Vup and in Expression field V[V] were inserted. In the same way as “Variables 2a”, “Variables 3a” was configured by selecting boundary No.6, Variable Name by Vdown and Variable Expression V[V].Then I have configured my material as: In Material1->basic, I have added an Analytic. The Function name in Analytic was changes to my_sigma. I put t as my Argument and I have modified Parameters tables by Expression= if(abs(Vup-Vdown)>500,1e-4,1e-15) Arguments=t When I run the study the outcome error is Vup is undefined variable. Is it possible to know steps? really appreciate your help

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 27.04.2013, 09:30 GMT-4
Hi

there is one very common error when using COMSOL, it's not noticing when one handle a field (function of x,y,z,t) and when one operate with a scalar (a number or at most a function of t time)

V is a dependent variable, it's a scalar field as its normally to be written out as V(x,y,z,t) (in opposition to B the magnetic vector field that is = three scalar field (Bx(x,y,z,t), By(x,y,z,t), Bz(x,y,z,t)) combined to form a vector field)

So if you define a variable on a boundary or an edge and call it my_V = V (implicit V(x,y,z,t) ) then you are defining a field, and in this case it's defined only along the boundary/edge and it's value might vary along the edge/boundary depending on the (x,y,z,t) position in space and time.

But this variable is NOT defined outside the boundary / edge from where you have selected its definition.

To be fully GLOBAL, you must define a variable as an integration or an average over an entity (= domain, boundary edge or point) such that the variable passing through this integration or average OPERATOR looses its spatial dependence, and keeps at best the time dependency.

If you want to have a material element dx*dy*dz in a domain, depend someway on a variable V(x,y,z,t) defined on a boundary, you must use a PROJECTION operator to project the localisation of your dx*dy*dz of whatever coordinates, over to your edge/boundary, given a to be defined projection law, and then, that variable coming out of the projection operator will take the local coordinates of each dx*dy*dz and project it onto the boundar/ edge, and read out the voltage at that corresponding location.
It is then also obious that this "projection operator" must be defined such that it maps each point in the source entity (=domain, boundary, edge, point) to a single point in the destination entity

Hope it got it clear

This is what I guess you are doing wrong, but I too, might be wrong ;)

--
Good luck
Ivar
Hi there is one very common error when using COMSOL, it's not noticing when one handle a field (function of x,y,z,t) and when one operate with a scalar (a number or at most a function of t time) V is a dependent variable, it's a scalar field as its normally to be written out as V(x,y,z,t) (in opposition to B the magnetic vector field that is = three scalar field (Bx(x,y,z,t), By(x,y,z,t), Bz(x,y,z,t)) combined to form a vector field) So if you define a variable on a boundary or an edge and call it my_V = V (implicit V(x,y,z,t) ) then you are defining a field, and in this case it's defined only along the boundary/edge and it's value might vary along the edge/boundary depending on the (x,y,z,t) position in space and time. But this variable is NOT defined outside the boundary / edge from where you have selected its definition. To be fully GLOBAL, you must define a variable as an integration or an average over an entity (= domain, boundary edge or point) such that the variable passing through this integration or average OPERATOR looses its spatial dependence, and keeps at best the time dependency. If you want to have a material element dx*dy*dz in a domain, depend someway on a variable V(x,y,z,t) defined on a boundary, you must use a PROJECTION operator to project the localisation of your dx*dy*dz of whatever coordinates, over to your edge/boundary, given a to be defined projection law, and then, that variable coming out of the projection operator will take the local coordinates of each dx*dy*dz and project it onto the boundar/ edge, and read out the voltage at that corresponding location. It is then also obious that this "projection operator" must be defined such that it maps each point in the source entity (=domain, boundary, edge, point) to a single point in the destination entity Hope it got it clear This is what I guess you are doing wrong, but I too, might be wrong ;) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 04.05.2013, 07:13 GMT-4
Dear Ivar
I have another problem while my simulation ,
I set two probs under model , definition on two boundary of my geometry and the average of the voltages is measured by them.then the measured data is transferring to a function of Matlab for calculating conductivity , ( there is no error untill this part) after that I define another prob on DOMAIN for measure integration of current density norm .this is new variable that I want transfer to function of Matlab , but the problem is when I define this new prob I get the error that say: circular dependency
I want know how can i solve this error? and what is the meaning of this error?
thanks in advance
Hadi
Dear Ivar I have another problem while my simulation , I set two probs under model , definition on two boundary of my geometry and the average of the voltages is measured by them.then the measured data is transferring to a function of Matlab for calculating conductivity , ( there is no error untill this part) after that I define another prob on DOMAIN for measure integration of current density norm .this is new variable that I want transfer to function of Matlab , but the problem is when I define this new prob I get the error that say: circular dependency I want know how can i solve this error? and what is the meaning of this error? thanks in advance Hadi

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.