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.

linking progress variable to other variables

Please login with a confirmed email address before reporting spam

Hi,

Im trying to create a model for a project, my current model is adiabatic but im adding heat loss through enthalpy.

What i want comsol to do at this stage, while i have the following:

a progres variable that goes from 0 to 1 to 0 again, dependant on time
a number of variables dependant on progres variable from 0 to 1 ( not the same values for PV as in the time dependant one)

So how can i link these in a correct way, that when the progress variable gets a certain value at a certain time, the other variables get assigned a value corresponding to the nearest progress variable?

regards

2 Replies Last Post 9 lug 2014, 08:56 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 7 lug 2014, 06:04 GMT-4
You can define a piecewise function (call it for example f) in global or component definitions and use this in the expressions for the quantities that you want to depend on this variable as 'f(t)'.
You can define a piecewise function (call it for example f) in global or component definitions and use this in the expressions for the quantities that you want to depend on this variable as 'f(t)'.

Frank van Gool COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 9 lug 2014, 08:56 GMT-4
Dear Tano,

As Pieter says, you can define functions in COMSOL, and the input can be anything, even the results form a different function.

What you do is create a function for your PV, which is dependent on time (t). Say you create an interpolation function called "int1". This is used as follows: "int1(t)", and returns the PV value at a specific time.
(hint: for time dependent functions it is beneficial to enable piecewise cubic interpolation for a smooth function)

The other variables also need a function, say piecewise functions. You define this from 0 to 1 with your function. Say that this is called "pw1".
(Hint: the function name is defined at the top of the settings window of the function)

The way you link these is then as follows: "pw1(int1(t))", which fills in t into the PV function, returns the values between 0 and 1, and uses that as input for the next function.

Attached you can find a simple example on this.

Best regards,
Frank
Dear Tano, As Pieter says, you can define functions in COMSOL, and the input can be anything, even the results form a different function. What you do is create a function for your PV, which is dependent on time (t). Say you create an interpolation function called "int1". This is used as follows: "int1(t)", and returns the PV value at a specific time. (hint: for time dependent functions it is beneficial to enable piecewise cubic interpolation for a smooth function) The other variables also need a function, say piecewise functions. You define this from 0 to 1 with your function. Say that this is called "pw1". (Hint: the function name is defined at the top of the settings window of the function) The way you link these is then as follows: "pw1(int1(t))", which fills in t into the PV function, returns the values between 0 and 1, and uses that as input for the next function. Attached you can find a simple example on this. Best regards, Frank

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.