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.

Previous Solution as Constant

Please login with a confirmed email address before reporting spam

Hey all,

I have a question regarding a multiple study setup. I would like to use the last value of a variable defined in one study as a constant in a variable for the next study. So for example:
My first study - study 1 - heats up the model for a certain time which gives me a temperature T(end). Now I want to use this T(end) to define a variable in the second - study 2 - which uses this expression T(end) like: Tref = T(end)+t*10[deg]
How would I go about doing this?

thanks in advance for your help

1 Reply Last Post 1 feb 2016, 10:31 GMT-5
Henrik Sönnerlind COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 1 feb 2016, 10:31 GMT-5
Hi,

You can use the 'withsol' operator to point at results from a previous solution. There are several different possible sets of arguments to this operator, depending on the level of detail you need for picking the right set of results. You can find the details in the documentation.

In the simplest case you would write an expression like

withsol('sol1',T)+t*10[deg]

A call like

withsol('sol1',T,setval(t,0.5))

will pick the temperature from t=0.5 in solution sol1, etc.

Regards,
Henrik



Hi, You can use the 'withsol' operator to point at results from a previous solution. There are several different possible sets of arguments to this operator, depending on the level of detail you need for picking the right set of results. You can find the details in the documentation. In the simplest case you would write an expression like withsol('sol1',T)+t*10[deg] A call like withsol('sol1',T,setval(t,0.5)) will pick the temperature from t=0.5 in solution sol1, etc. Regards, Henrik

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.