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.

Manually assigning "from material"

Please login with a confirmed email address before reporting spam

I am trying to solve the Helmholtz equation. One parameter it has is the absorption coefficient "a", which I would like to be material dependent (this is the inhomogeneous Helmholtz equation). Specifically, it should be dependent on epsilonr, the relative permittivity.

I am not lucky enough to have a pull down menu that says "from material" in this case. I looked into the equations of some modules and saw that you could do something like "mat.epsilonr". When I try it, it doesn't work.

I know how to access material properties via "mod1.mat1.def.epsilonr11", but I need it to be geometry dependent.

Previously, I got away with the rather inelegant boolean expression "if(dom==1,epsilonr=1,epsilonr=8-8*i)". This at least works, but not for boundaries with different materials.

Please let me know if you have any ideas on how to do this.

1 Reply Last Post Jan 30, 2011, 3:44 a.m. EST
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 Jan 30, 2011, 3:44 a.m. EST
Hi

using the "mat.epsilonr" points directly to the material db, and you do not know it its mat1 or mat2 ... from one model to the other, or if you change the materials, or their order in your model.

Mostly it's better to either:
a) define a parameter and you control what you are doing, and refer to that

b) you define a variable and define the reference to mat.epsilonr there, well in view, to easily adapt it if you change something in your model later

c) use the material link (ec.epsilonr or solid.rho for structural) because then COMSOL looks after the logic to get the right mat, ,mat1 etc into the generic "myphyscs.epsilonr" variable name (turn on the equations via Preferences to see what is behind.

One ting to take care of is the "implicit" notation of COMSOL, when you write ec.epsilonr this means in fact "the one activ for the elements in the current domain". So you need to take car that the domain"id" is clearly defined. I mostly read in a generic way "myphysics.variable(i)" where (i) means it related to the domain (or boundary "i") and "i" runs over the selected domains (resp. boundaries) from the selection list.

The corollary is that, in a general global equation, "myphysics.variable" is not uniquely defined as you do not know to which "i" to refer to, then the option a) or b) are the best

--
Good luck
Ivar
Hi using the "mat.epsilonr" points directly to the material db, and you do not know it its mat1 or mat2 ... from one model to the other, or if you change the materials, or their order in your model. Mostly it's better to either: a) define a parameter and you control what you are doing, and refer to that b) you define a variable and define the reference to mat.epsilonr there, well in view, to easily adapt it if you change something in your model later c) use the material link (ec.epsilonr or solid.rho for structural) because then COMSOL looks after the logic to get the right mat, ,mat1 etc into the generic "myphyscs.epsilonr" variable name (turn on the equations via Preferences to see what is behind. One ting to take care of is the "implicit" notation of COMSOL, when you write ec.epsilonr this means in fact "the one activ for the elements in the current domain". So you need to take car that the domain"id" is clearly defined. I mostly read in a generic way "myphysics.variable(i)" where (i) means it related to the domain (or boundary "i") and "i" runs over the selected domains (resp. boundaries) from the selection list. The corollary is that, in a general global equation, "myphysics.variable" is not uniquely defined as you do not know to which "i" to refer to, then the option a) or b) are the best -- 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.