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.

Accessing material parameters in functions

Please login with a confirmed email address before reporting spam

Hi,
I am trying to create a model with a spatially varying material parameter (in this case the piezoelectric coupling constants). However, these depend on the material's Young's modulus (E) and Poisson's ratio (nu). When I write the function using E and nu, they are errors as undefined variables. I can define values for EP an nuP as global parameters, and that works, but I would like to just use the material parameters. How do I access the material parameters in defining other material parameters as a function.
Thank you
Greg Finney

5 Replies Last Post Aug 26, 2010, 11:04 a.m. EDT
Andrew Prudil Nuclear Materials

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Aug 20, 2010, 1:35 p.m. EDT
Not entirely sure this will work, but you can try using the mat notation.

For the Young's modulus of the first material you would use "mat1.E". Although this is annoying that you can't use the material name, it might let you do what you are trying to accomplish.
Not entirely sure this will work, but you can try using the mat notation. For the Young's modulus of the first material you would use "mat1.E". Although this is annoying that you can't use the material name, it might let you do what you are trying to accomplish.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Aug 24, 2010, 10:57 p.m. EDT
Thank you for your response.

> For the Young's modulus of the first material you would use "mat1.E".

When I tried this, I used mat1.E in the expression for the function I wanted to define, but COMSOL returned an error that mat1.E is an undefined variable. Is there something else I need to do for COMSOL to recognize the mat1.E notation?
Thank you for your response. > For the Young's modulus of the first material you would use "mat1.E". When I tried this, I used mat1.E in the expression for the function I wanted to define, but COMSOL returned an error that mat1.E is an undefined variable. Is there something else I need to do for COMSOL to recognize the mat1.E notation?

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 Aug 25, 2010, 5:30 a.m. EDT
Hi

it might be mat2 if you have defined 2 materials, you can check this either by studying the eqautions, looking into the "history file (v3.5) or save the file A COPY as an "m" file (note: in V4 you cannot open an "m" file witout passing via matlab if I remember right) and take a look on the inside code.

The access via the mat#._whatever_ is slightly tricky and depends on the history of you modelling, ad could be (to be hecked) changed again if you do a File model reset

--
Good luck
Ivar
Hi it might be mat2 if you have defined 2 materials, you can check this either by studying the eqautions, looking into the "history file (v3.5) or save the file A COPY as an "m" file (note: in V4 you cannot open an "m" file witout passing via matlab if I remember right) and take a look on the inside code. The access via the mat#._whatever_ is slightly tricky and depends on the history of you modelling, ad could be (to be hecked) changed again if you do a File model reset -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Aug 26, 2010, 9:20 a.m. EDT
I am using Comsol 4.0. I was able to confirm the material is mat1, but there were some old definitions in the m file. In addition, I noticed references in the m file to what appeared to be variables for "youngsmodulus" and "poissonsratio" rather than variables "E" and "nu" as I expected. I reset the file history and tried again using both E and youngsmodulus as variable names, but continued to get undefined variable errors reported. Is this notation explained anywhere in the documentation? Could this problem be a result of using the material parameters from the basic physics in the piezoelectric physics section?

Thanks for any additional insights.
I am using Comsol 4.0. I was able to confirm the material is mat1, but there were some old definitions in the m file. In addition, I noticed references in the m file to what appeared to be variables for "youngsmodulus" and "poissonsratio" rather than variables "E" and "nu" as I expected. I reset the file history and tried again using both E and youngsmodulus as variable names, but continued to get undefined variable errors reported. Is this notation explained anywhere in the documentation? Could this problem be a result of using the material parameters from the basic physics in the piezoelectric physics section? Thanks for any additional insights.

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 Aug 26, 2010, 11:04 a.m. EDT
Hi

If I have understood the Comsol approach correct, we are supposed to assign material to domains and access the variables via the domain indexes in an indirect way.
By addressing directly the mat# we are one level deeper and interfere easier with the COMSOL internals, and two masteer cooks on the same dish never give a good result ;)

COMSOl uses several level of names to hierarchy thme depending where they are accessed, we are supposed to interact directly with last" highest level

Unfortunately, This is probably not helping you much
--
Good luck
Ivar
Hi If I have understood the Comsol approach correct, we are supposed to assign material to domains and access the variables via the domain indexes in an indirect way. By addressing directly the mat# we are one level deeper and interfere easier with the COMSOL internals, and two masteer cooks on the same dish never give a good result ;) COMSOl uses several level of names to hierarchy thme depending where they are accessed, we are supposed to interact directly with last" highest level Unfortunately, This is probably not helping you much -- 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.