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.

Setting initial values for an iterative solver

Please login with a confirmed email address before reporting spam

Comsol user interface shows some options for setting initial values at the stationary study step at 'Initial values of variables solved for'. These are either zero or a solution - but we want to set the initial values directly as an expression e.g. 'x'. Is there a way to do this via Matlab or Comsol user interface? If there is no way to do this: is it possible to set up a some solution object containing e.g. the values for 'x' and using that as initial value for our iterative solver?

4 Replies Last Post 14 dic 2012, 12:15 GMT-5
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 11 dic 2012, 02:04 GMT-5
Hi

you can set any function filed or variable in the equation for the initial conditions, just as for any BC in COMSOL, that is the strength of the tool.

Now, many people havent really understood the dfault notations, when you select an Entity (domain for physics, or a Boundary for BC's, you are in fact saying "for all x,y,z belonging to the selected entity" my value is my_expression. So you can write

5*sin(2*pi*freq_spatial*x)*exp(-y^2/sigmay^2)*exp(-kt*t)

if this makes any sens for you ;)

Juast as you can write a scalar that remains constant over all the surface respectively volume of your ENtity.

only some BC as the lumped ports do not accept spatially depending variables, only time variable, as these are defined as average values spread out over the full BC
--
Good luck
Ivar
Hi you can set any function filed or variable in the equation for the initial conditions, just as for any BC in COMSOL, that is the strength of the tool. Now, many people havent really understood the dfault notations, when you select an Entity (domain for physics, or a Boundary for BC's, you are in fact saying "for all x,y,z belonging to the selected entity" my value is my_expression. So you can write 5*sin(2*pi*freq_spatial*x)*exp(-y^2/sigmay^2)*exp(-kt*t) if this makes any sens for you ;) Juast as you can write a scalar that remains constant over all the surface respectively volume of your ENtity. only some BC as the lumped ports do not accept spatially depending variables, only time variable, as these are defined as average values spread out over the full BC -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 12 dic 2012, 12:37 GMT-5
Thank you for your help - unfortunately it doesn't work using the 'Initial values' node given by the Solid Mechanics physics. My displacement field variable 'u' starts at zero in each dimension. When I change one of the values e.g. to 'x' Comsol throws an error. Is this feature also valid for boundary value problems (I'm using periodic boundary conditions) or only for initial vaule problems?
Best regards
Thank you for your help - unfortunately it doesn't work using the 'Initial values' node given by the Solid Mechanics physics. My displacement field variable 'u' starts at zero in each dimension. When I change one of the values e.g. to 'x' Comsol throws an error. Is this feature also valid for boundary value problems (I'm using periodic boundary conditions) or only for initial vaule problems? Best regards

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 12 dic 2012, 15:24 GMT-5
Hi

first of all in the initial conditions for solid, you should define material frame hence use upper-case letters X,Y,Z,R

Then if you define only a displacement, the stress values etc are not set accordingly, for that you need to solve a stationary case before your time series (or whatever you plan to make as follow up simulation), and use this stationary case as initial conditions

Hope my simple model (v4.3a upd1) might help

--
Good luck
Ivar
Hi first of all in the initial conditions for solid, you should define material frame hence use upper-case letters X,Y,Z,R Then if you define only a displacement, the stress values etc are not set accordingly, for that you need to solve a stationary case before your time series (or whatever you plan to make as follow up simulation), and use this stationary case as initial conditions Hope my simple model (v4.3a upd1) might help -- Good luck Ivar


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 14 dic 2012, 12:15 GMT-5
Hi Ivar,
thank you again for you superb help here...I finally found out that my problem was not the initial values...they work as you've described it. My model uses periodic boundary conditions and an integration constraint to make the solution distinct. Without the integration constraint everything works fine now...but when I enable it the convergence ot the solver 'jumps' and finally fails to find a solution. Unfortunately setting initial vaules doesn't help here. I've opened a Comsol support case for the issue.
Have a nice weekend and best regards,
Chris
Hi Ivar, thank you again for you superb help here...I finally found out that my problem was not the initial values...they work as you've described it. My model uses periodic boundary conditions and an integration constraint to make the solution distinct. Without the integration constraint everything works fine now...but when I enable it the convergence ot the solver 'jumps' and finally fails to find a solution. Unfortunately setting initial vaules doesn't help here. I've opened a Comsol support case for the issue. Have a nice weekend and best regards, Chris

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.