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.

Parametric run and material library

Please login with a confirmed email address before reporting spam

Hi,
I am trying to model pipe with heat flux. One inlet, one outlet and two heat elements. Two inlet speeds and two different material properties for flow (water and air). I use Comsol material library.
I know how to use one parameter:
Parametric name : inlet
Parametric values : {0.5 1.0}

But how to use two parameters? And what is "parameter name" for material?
I have tried multiple ways... :) Maybe I don't understand syntax properly...
Should it parametric name be defined like lib.mat{1}.name='material', ns_mat1 or cc_mat1?
How material is defined to parametric values? {'air' 'water'} doesn't work..

I hope and fear that this has some trivial answer.

Thank for you help,
Matti Tähtinen


3 Replies Last Post Mar 10, 2010, 2:23 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 Mar 9, 2010, 8:10 a.m. EST
Hi

there is another discussion somewhere on the forum about multiple parameters

If I remember right in the GUI you set

param name: param1 param2 ...
param value: 1 2 ... 3 4 ... 4 5 ...

in pairs for 2, or triplets for 3 ...

Just be aware that the FIRST parameter must be monotonously increasing (or decreasing)

Good luck
Ivar

Hi there is another discussion somewhere on the forum about multiple parameters If I remember right in the GUI you set param name: param1 param2 ... param value: 1 2 ... 3 4 ... 4 5 ... in pairs for 2, or triplets for 3 ... Just be aware that the FIRST parameter must be monotonously increasing (or decreasing) Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Mar 9, 2010, 9:59 a.m. EST
Hi and thank you, Ivar.
Maybe I was not accurate enough. Those parameters are easy when it have been defined by user, but i don't have glue what is param name for material library name. Name which defines which material properties/functions Comsol picks from material library. Example air, water, cement etc. This would be good to know for example if we are comparing different materials with different loads at structure mechanism.
Probably this would be easier to work from Matlab, but that is not possible.

Why first parameter must be monotonously increasing/decreasing?

Sincerely,
Matti Tähtinen
Hi and thank you, Ivar. Maybe I was not accurate enough. Those parameters are easy when it have been defined by user, but i don't have glue what is param name for material library name. Name which defines which material properties/functions Comsol picks from material library. Example air, water, cement etc. This would be good to know for example if we are comparing different materials with different loads at structure mechanism. Probably this would be easier to work from Matlab, but that is not possible. Why first parameter must be monotonously increasing/decreasing? Sincerely, Matti Tähtinen

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 Mar 10, 2010, 2:23 a.m. EST
Hi

first for the param of the solver, I got confused by your question so this is probably not 100% related:

COMSOL asks for a monotonously increasing decreasing parameter value for the first element (if multiple parameters the second might not be monotonous inc/dec) so if you want to use the parametric solver, always check that your value is not repeating or changing derivative, its by design, and is written in the doc

--------------
for the material, I agree there is a double index in the system when you define a material attached to a domain, and the material is coming from the library you get a first pointer to the material in your model material database of the type mat1_variablename mat2_variablename ... see the "lib.mat{1}. ..."

the easiest is to dump your file in ".m format, or look into the "history file"

The materials might have constant values or piecewise functions "fcns{1}. ..." that are defined as you can see below

If you want to access them in matlab the easist is to study how COMSOL is using them and do the same

% Library materials
clear lib
lib.mat{1}.name='1006 (UNS G10060)';
lib.mat{1}.varname='mat1';
lib.mat{1}.variables.nu='nu(T[1/K])';
lib.mat{1}.variables.res='res(T[1/K])[ohm*m]';
lib.mat{1}.variables.E='E(T[1/K])[Pa]';
lib.mat{1}.variables.CTE='CTE(T[1/K])[1/K]';
lib.mat{1}.variables.sigma='sigma(T[1/K])[S/m]';
lib.mat{1}.variables.dL='dL(T[1/K])-dL(Tempref[1/K])';
lib.mat{1}.variables.alpha='alpha(T[1/K])[1/K]+(Tempref-293[K])/(T-Tempref)*(alpha(T[1/K])[1/K]-alpha(Tempref[1/K])[1/K])';
lib.mat{1}.variables.C='C(T[1/K])[J/(kg*K)]';
lib.mat{1}.variables.kappa='kappa(T[1/K])[Pa]';
lib.mat{1}.variables.mu='mu(T[1/K])[Pa]';
lib.mat{1}.variables.rho='rho(T[1/K])[kg/m^3]';
lib.mat{1}.variables.k='k(T[1/K])[W/(m*K)]';
clear fcns
fcns{1}.type='piecewise';
fcns{1}.name='dL(T)';
fcns{1}.extmethod='const';
fcns{1}.subtype='poly';
fcns{1}.expr={{'0','-0.002967403','1','1.81617E-5','2','-9.276156E-8','3', ...
'2.54081E-10'},{'0','-0.002341855','1','4.083948E-6','2','1.512293E-8','3', ...
'-6.083782E-12'}};
fcns{1}.intervals={'91.0','215.0','960.0'};

.....

the assignment onto your domain is done here for the first, respectively the second sub-domains defined within the {firstdomain, secondomain} (I added just 2 sub-domains) in this model.
For some parameters obviously the material data was not defined and you get the default cnstants,

SO in V3.5a ALWAYS CHECK ALL YOUR VARIABLES WHEN YOU IMPORT A LIBRARY MATERIAL

as you migh have some variables not defined in the library and they then take the default steel or copper values, this is sometime misleading. From my understanding this default approach is no longer there in V4, you will get error messages if you forget to define a merial constant/variable, I prefer that way

%
equ.rho = {'mat2_rho(T[1/K])[kg/m^3]','mat1_rho(T[1/K])[kg/m^3]'};
equ.E = {'mat2_E(T[1/K])[Pa]','mat1_E(T[1/K])[Pa]'};
equ.nu = {0.33,'mat1_nu(T[1/K])'};
equ.mu = {8e5,'mat1_mu(T[1/K])[Pa]'};
equ.alpha = {'mat2_alpha(T[1/K])[1/K]+(Tempref_smps-293[K])/(T-Tempref_smps)*(mat2_alpha(T[1/K])[1/K]-mat2_alpha(Tempref_smps[1/K])[1/K])', ...
'mat1_alpha(T[1/K])[1/K]+(Tempref_smps-293[K])/(T-Tempref_smps)*(mat1_alpha(T[1/K])[1/K]-mat1_alpha(Tempref_smps[1/K])[1/K])'};

Sometimes the Tempref gives you some surprises it is the reference temperature for the linear expansion used in the structural application module mainly

In the matrial librbay display you can "easily" plot the data (unfortunately the units are not shown on the graphs)


hope this helps

good luck
Ivar
Hi first for the param of the solver, I got confused by your question so this is probably not 100% related: COMSOL asks for a monotonously increasing decreasing parameter value for the first element (if multiple parameters the second might not be monotonous inc/dec) so if you want to use the parametric solver, always check that your value is not repeating or changing derivative, its by design, and is written in the doc -------------- for the material, I agree there is a double index in the system when you define a material attached to a domain, and the material is coming from the library you get a first pointer to the material in your model material database of the type mat1_variablename mat2_variablename ... see the "lib.mat{1}. ..." the easiest is to dump your file in ".m format, or look into the "history file" The materials might have constant values or piecewise functions "fcns{1}. ..." that are defined as you can see below If you want to access them in matlab the easist is to study how COMSOL is using them and do the same % Library materials clear lib lib.mat{1}.name='1006 (UNS G10060)'; lib.mat{1}.varname='mat1'; lib.mat{1}.variables.nu='nu(T[1/K])'; lib.mat{1}.variables.res='res(T[1/K])[ohm*m]'; lib.mat{1}.variables.E='E(T[1/K])[Pa]'; lib.mat{1}.variables.CTE='CTE(T[1/K])[1/K]'; lib.mat{1}.variables.sigma='sigma(T[1/K])[S/m]'; lib.mat{1}.variables.dL='dL(T[1/K])-dL(Tempref[1/K])'; lib.mat{1}.variables.alpha='alpha(T[1/K])[1/K]+(Tempref-293[K])/(T-Tempref)*(alpha(T[1/K])[1/K]-alpha(Tempref[1/K])[1/K])'; lib.mat{1}.variables.C='C(T[1/K])[J/(kg*K)]'; lib.mat{1}.variables.kappa='kappa(T[1/K])[Pa]'; lib.mat{1}.variables.mu='mu(T[1/K])[Pa]'; lib.mat{1}.variables.rho='rho(T[1/K])[kg/m^3]'; lib.mat{1}.variables.k='k(T[1/K])[W/(m*K)]'; clear fcns fcns{1}.type='piecewise'; fcns{1}.name='dL(T)'; fcns{1}.extmethod='const'; fcns{1}.subtype='poly'; fcns{1}.expr={{'0','-0.002967403','1','1.81617E-5','2','-9.276156E-8','3', ... '2.54081E-10'},{'0','-0.002341855','1','4.083948E-6','2','1.512293E-8','3', ... '-6.083782E-12'}}; fcns{1}.intervals={'91.0','215.0','960.0'}; ..... the assignment onto your domain is done here for the first, respectively the second sub-domains defined within the {firstdomain, secondomain} (I added just 2 sub-domains) in this model. For some parameters obviously the material data was not defined and you get the default cnstants, SO in V3.5a ALWAYS CHECK ALL YOUR VARIABLES WHEN YOU IMPORT A LIBRARY MATERIAL as you migh have some variables not defined in the library and they then take the default steel or copper values, this is sometime misleading. From my understanding this default approach is no longer there in V4, you will get error messages if you forget to define a merial constant/variable, I prefer that way % equ.rho = {'mat2_rho(T[1/K])[kg/m^3]','mat1_rho(T[1/K])[kg/m^3]'}; equ.E = {'mat2_E(T[1/K])[Pa]','mat1_E(T[1/K])[Pa]'}; equ.nu = {0.33,'mat1_nu(T[1/K])'}; equ.mu = {8e5,'mat1_mu(T[1/K])[Pa]'}; equ.alpha = {'mat2_alpha(T[1/K])[1/K]+(Tempref_smps-293[K])/(T-Tempref_smps)*(mat2_alpha(T[1/K])[1/K]-mat2_alpha(Tempref_smps[1/K])[1/K])', ... 'mat1_alpha(T[1/K])[1/K]+(Tempref_smps-293[K])/(T-Tempref_smps)*(mat1_alpha(T[1/K])[1/K]-mat1_alpha(Tempref_smps[1/K])[1/K])'}; Sometimes the Tempref gives you some surprises it is the reference temperature for the linear expansion used in the structural application module mainly In the matrial librbay display you can "easily" plot the data (unfortunately the units are not shown on the graphs) hope this helps 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.