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.

I want to know how to use built-in material property in PDE module

Please login with a confirmed email address before reporting spam

Hello, everyone

it's simple question

I simulate some model with PDE

but, i cannot get information from Material tab

For example, Materials -> Argon{mat1} -> Density(rho), Expression : rho(T)

How to use that value in the PDE?

Below is error code

Failed to evaluate expression.
- Expression: mat1.rho
Failed to evaluate variable.
- Variable: mat1.rho
- Global scope

I tried mat1.rho, mat.rho, mod1.mat1.rho .... etc at the expression box in the PDE

but anything works

Thank you

Lee

11 Replies Last Post 2010/07/15 8:16 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 2010/07/13 12:24 GMT-4
Hi

There are a few caveat with library materials. One is that they are often derived with internal variables such as temperature T and pressure p, and often you do not use these variables by default in your model.

Then you MUST define a Constant T=20[degC] or whatever fits you, and p=1[atm]. I believe you do not have any T defined, or did I miss the point ? (that error is at least a common one).

Next, is that when you define a material from the library, COMSOL 3.5a defines variables "mat1.something" "mat2.something" etc. and set the different (sub)domains material properties equal to the relevant "mat1.something" etc.

So either you use the domain definition through COMSOL or you access the "mat1.something" directly (but this is depending on the order you used to call them into the model.

in anycase you have a rho(T) required so T must be defined, if not through the application mode, than as a Constant

Good luck
Ivar
Hi There are a few caveat with library materials. One is that they are often derived with internal variables such as temperature T and pressure p, and often you do not use these variables by default in your model. Then you MUST define a Constant T=20[degC] or whatever fits you, and p=1[atm]. I believe you do not have any T defined, or did I miss the point ? (that error is at least a common one). Next, is that when you define a material from the library, COMSOL 3.5a defines variables "mat1.something" "mat2.something" etc. and set the different (sub)domains material properties equal to the relevant "mat1.something" etc. So either you use the domain definition through COMSOL or you access the "mat1.something" directly (but this is depending on the order you used to call them into the model. in anycase you have a rho(T) required so T must be defined, if not through the application mode, than as a Constant Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010/07/13 22:01 GMT-4
Hi

I'm using COMSOL 4.0 :)

I did again as your advice.

could you check the attached file

I just want to figure out working or not(Is setting path right expression?)

I set the value pA, T, and path "mat1.rho" in the PDE at "f"

rho has "pA*0.02897/8.314/T"

so I think rho is constant now.

but error comes out

Failed to evaluate expression.
- Expression: d((mat1.rho*test(mod1.u)-mod1.ux*test(mod1.ux)-mod1.uy*test(mod1.uy))*(dvol),{test@0})
Failed to evaluate variable.
- Variable: mat1.rho
- Geometry: 1
- Domain: 1

I think the problem is "path"



and then I put the rho equation into variable

rho1 = pA*0.02897/8.314/T, f = rho1 (in PDE)

this second one is working



I do want to know is "how to set the path for using the material property"

please give me your answer again :)
Hi I'm using COMSOL 4.0 :) I did again as your advice. could you check the attached file I just want to figure out working or not(Is setting path right expression?) I set the value pA, T, and path "mat1.rho" in the PDE at "f" rho has "pA*0.02897/8.314/T" so I think rho is constant now. but error comes out Failed to evaluate expression. - Expression: d((mat1.rho*test(mod1.u)-mod1.ux*test(mod1.ux)-mod1.uy*test(mod1.uy))*(dvol),{test@0}) Failed to evaluate variable. - Variable: mat1.rho - Geometry: 1 - Domain: 1 I think the problem is "path" and then I put the rho equation into variable rho1 = pA*0.02897/8.314/T, f = rho1 (in PDE) this second one is working I do want to know is "how to set the path for using the material property" please give me your answer again :)


Magnus Ringh COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010/07/14 2:22 GMT-4
Hi,

You are right about the path; one step is missing in the expression. You need to use the following syntax:

mat1.def.rho(pA,T)

where "def" points to the Basic property group, which is the source for the density rho. "def" is the tag for that node, which you can view and possibly edit by right-clicking the Basic node and choose Properties.

Best regards,
Magnus Ringh, COMSOL
Hi, You are right about the path; one step is missing in the expression. You need to use the following syntax: mat1.def.rho(pA,T) where "def" points to the Basic property group, which is the source for the density rho. "def" is the tag for that node, which you can view and possibly edit by right-clicking the Basic node and choose Properties. Best regards, Magnus Ringh, COMSOL

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010/07/14 3:52 GMT-4
Thank you all :)
Thank you all :)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010/07/14 13:20 GMT-4
I have more or less exactly the same problem. I have "Oil" as a material, it has property tag "mat2", then it has Basic which has tag "def" and then thermal expansion coefficient "alpha" . There are no model inputs.

So I type in mat2.def.alpha as part of expression for a source term and nope, cannot evaluate expression.

I also tried mat2.def.alpha()

If you look at the attached you can see it documented under "Error" ad/or you can find the source of the error in mod2->PorousHeatTransfer->JTSourceInDarcy.

Maybe the problem is that thermal coefficients are defined as anisotropic alpha11, etc in the Basic, so I've also tried alpha11, etc.

Regards, John
I have more or less exactly the same problem. I have "Oil" as a material, it has property tag "mat2", then it has Basic which has tag "def" and then thermal expansion coefficient "alpha" . There are no model inputs. So I type in mat2.def.alpha as part of expression for a source term and nope, cannot evaluate expression. I also tried mat2.def.alpha() If you look at the attached you can see it documented under "Error" ad/or you can find the source of the error in mod2->PorousHeatTransfer->JTSourceInDarcy. Maybe the problem is that thermal coefficients are defined as anisotropic alpha11, etc in the Basic, so I've also tried alpha11, etc. Regards, John


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010/07/14 14:14 GMT-4
Hm, seems to be a difference between calling a function versus a variable.

If you have, say, rho(T) defined in "def" defined in "mat3", then you can write mat3.def.rho(T) and all is good.

But if you have, say, rho defined in "def" defined in "mat3", then you cannot write mat3.def.rho

Tricky!!
Hm, seems to be a difference between calling a function versus a variable. If you have, say, rho(T) defined in "def" defined in "mat3", then you can write mat3.def.rho(T) and all is good. But if you have, say, rho defined in "def" defined in "mat3", then you cannot write mat3.def.rho Tricky!!

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010/07/14 16:36 GMT-4
Am having the same problem.

Reported error is ... failed to evaluate Jacobian : Varibale mat.rho.

Please help at the earliest.

>> Shailendra
Am having the same problem. Reported error is ... failed to evaluate Jacobian : Varibale mat.rho. Please help at the earliest. >> Shailendra

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010/07/14 16:39 GMT-4
Hi, can you be a little more clear on the error message. Failure to evaluate Jacobian could be lots of things....
Hi, can you be a little more clear on the error message. Failure to evaluate Jacobian could be lots of things....

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010/07/14 17:08 GMT-4
Thanks for the prompt response.

I need help on resolving an error :

Have enabled MATERIALS to use Nitrogen properties.

Even though have "user specified" all the thermal properties of Nitrogen and tried a combination of enable and dissable the above MATERIALS LIBRARY, the error is getting repeated.

Have also entered /added the temperature T in MATERIALS >> BASIC and USER DEFINED, as 248 deg K.

The error does not go away.

Have spent the whole day and now night on this issue.

Regards,

>> Shailendra

Thanks for the prompt response. I need help on resolving an error : Have enabled MATERIALS to use Nitrogen properties. Even though have "user specified" all the thermal properties of Nitrogen and tried a combination of enable and dissable the above MATERIALS LIBRARY, the error is getting repeated. Have also entered /added the temperature T in MATERIALS >> BASIC and USER DEFINED, as 248 deg K. The error does not go away. Have spent the whole day and now night on this issue. Regards, >> Shailendra


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 2010/07/14 18:07 GMT-4
Hei Magnus

If I understand well all materials are

matN.def.name

where N=1,2,3 ... for the order as the material appear in the list

.def. is there for definition (not really documented so far)

and "name" stands for whatever material property name we are interested in.

Then comes the optional (pA,T), or (T) or just noting more, if the material is defined as a function of (pA,T) or of (T) or noting if a constant.

Is that so ?

to find out if there is any need for the (T) or whatever, we can check the "Materials - My_material - Basic" entry to see what the calling sequence is.

But really, this should be better documented, I cannot see where the .def. comes from or is mentioned. It is neither not appearing in the equation lists, there I only see "mat.rho" no "mat1.def.rho" even for a constant rho, so obviously you have another intermediate level (that cannot be used at postprocessing calling level)

Ivar
Hei Magnus If I understand well all materials are matN.def.name where N=1,2,3 ... for the order as the material appear in the list .def. is there for definition (not really documented so far) and "name" stands for whatever material property name we are interested in. Then comes the optional (pA,T), or (T) or just noting more, if the material is defined as a function of (pA,T) or of (T) or noting if a constant. Is that so ? to find out if there is any need for the (T) or whatever, we can check the "Materials - My_material - Basic" entry to see what the calling sequence is. But really, this should be better documented, I cannot see where the .def. comes from or is mentioned. It is neither not appearing in the equation lists, there I only see "mat.rho" no "mat1.def.rho" even for a constant rho, so obviously you have another intermediate level (that cannot be used at postprocessing calling level) Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010/07/15 8:16 GMT-4
Hi Ivar,

May please help on these error messages.

Thanks and Regards,

>> Shailendra (15/7)
Hi Ivar, May please help on these error messages. Thanks and Regards, >> Shailendra (15/7)

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.