Discussion Forum

Accessing material parameters in functions

Topics: no topics

Thread index  |  Previous thread  |  Next thread  |  Start a new discussion

RSS FeedRSS feed   |   Email notificationsTurn on email notifications   |   5 Replies   Last post: August 26, 2010 3:04pm UTC
Greg Finney

Greg Finney

August 20, 2010 3:10pm UTC

Accessing material parameters in functions

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

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Andrew Prudil

Andrew Prudil

August 20, 2010 5:35pm UTC in response to Greg Finney

Re: Accessing material parameters in functions

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.

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Greg Finney

Greg Finney

August 25, 2010 2:57am UTC in response to Andrew Prudil

Re: Accessing material parameters in functions

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?

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Ivar Kjelberg

Ivar Kjelberg
Moderator

August 25, 2010 9:30am UTC in response to Greg Finney

Re: Accessing material parameters in functions

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

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Greg Finney

Greg Finney

August 26, 2010 1:20pm UTC in response to Ivar Kjelberg

Re: Accessing material parameters in functions

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.

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Ivar Kjelberg

Ivar Kjelberg
Moderator

August 26, 2010 3:04pm UTC in response to Greg Finney

Re: Accessing material parameters in functions

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

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse


Rules and guidelines