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.

Time varying change in parameter values

Please login with a confirmed email address before reporting spam

Hi. Is there a simple way to define a parameter that varies to known values with time. For example, I have data representing the change in hydraulic head in a well during a pumping test. The hydraulic head data is measured every 15 seconds during a 3000 second period of time, and represents data during the pumping interval as well as the recovery interval of time when the pump is shut off.

Basically, I would like to define the hydraulic head at the well location in my model as the change in hydraulic head as a function of time.

AJD

4 Replies Last Post 2012年11月30日 GMT-5 14:47
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 2012年11月29日 GMT-5 09:39
Hi

take your data and load it into an interpolation function you define, then set your BC pressure to these values (multiplied by whatever units or units conversion required)

--
Good luck
Ivar
Hi take your data and load it into an interpolation function you define, then set your BC pressure to these values (multiplied by whatever units or units conversion required) -- Good luck Ivar

Andrew Prudil Nuclear Materials

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012年11月30日 GMT-5 11:58
Hi,

In the past I found that I was able to:
-create a global function with the data I needed example_function(t)
-sample_parameter = example_function(t)

This method only works if you define it in the parameters area (and it will give you an orange text unknown variable warning due to t being undefined). When the model is run everything works fine. When I tried to use this with parameter sweeps to change which function a parameter was pointed to it failed. This is because one of the steps in the sweep is to evaluate all parameters to numerical values. Since it couldn't it stopped the sweep before it even started a simulation.

There is a a work around for sweeps using parameters to change a variable for example.

-example_parameter = 1
-example_function1(t)
-example_function2(t)
-example_variable = if(example_parameter = 1, example_function1(t), example_function2(t))

It works fine this way because all parameters can be evaluted to numbers. It is just a quirk of Comsol.

Obviously these methods cannot be used to change paramters which are used for solver settings, geometry or function definitions.
Hi, In the past I found that I was able to: -create a global function with the data I needed example_function(t) -sample_parameter = example_function(t) This method only works if you define it in the parameters area (and it will give you an orange text unknown variable warning due to t being undefined). When the model is run everything works fine. When I tried to use this with parameter sweeps to change which function a parameter was pointed to it failed. This is because one of the steps in the sweep is to evaluate all parameters to numerical values. Since it couldn't it stopped the sweep before it even started a simulation. There is a a work around for sweeps using parameters to change a variable for example. -example_parameter = 1 -example_function1(t) -example_function2(t) -example_variable = if(example_parameter = 1, example_function1(t), example_function2(t)) It works fine this way because all parameters can be evaluted to numbers. It is just a quirk of Comsol. Obviously these methods cannot be used to change paramters which are used for solver settings, geometry or function definitions.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2012年11月30日 GMT-5 13:05
Thanks for the response Ivar.

Worked like a charm! What i forgot is the (t) portion of the int_func(t).

In fact, I often find your responses in many of the discussion forum topics to be great solutions for my comsol problems.

Aaron
Thanks for the response Ivar. Worked like a charm! What i forgot is the (t) portion of the int_func(t). In fact, I often find your responses in many of the discussion forum topics to be great solutions for my comsol problems. Aaron

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 2012年11月30日 GMT-5 14:47
Hi

I'm not sure I'm gettinmg everything in your explanations, but one thing for sure: orange is no error but a unit incoherence, this COMSOL flags, as warning but consider that you know what you are doing, so it solves with the values it have, even if these might be wrong due to unit conversion errors, that COMSOl cannot know bout.

Among other most functions expect unitless values, but "t" is flagged as seconds in COMSOL so you should write (t[1/s]) to get a number without units representing a value of t as expressed in seconds (just as t[1/h] gives ouy time in real numbers representing hours etc).

You can only use PARAMETERS to set set your geoemtry, and to change a parameter overs a swee you need to add explicitely a "Parametric Node in the solver setting, and select the parameter you want to adapt. Then COMSOl will interpreste this parameter, redesign xyour geometry, remesh it and solve with the new geometry for each step (this works nicely so long the topology remains unchanged, but might fail if you your parameter changes the topology (i.e. swuare of one size =0 etc)

--
Good luck
Ivar
Hi I'm not sure I'm gettinmg everything in your explanations, but one thing for sure: orange is no error but a unit incoherence, this COMSOL flags, as warning but consider that you know what you are doing, so it solves with the values it have, even if these might be wrong due to unit conversion errors, that COMSOl cannot know bout. Among other most functions expect unitless values, but "t" is flagged as seconds in COMSOL so you should write (t[1/s]) to get a number without units representing a value of t as expressed in seconds (just as t[1/h] gives ouy time in real numbers representing hours etc). You can only use PARAMETERS to set set your geoemtry, and to change a parameter overs a swee you need to add explicitely a "Parametric Node in the solver setting, and select the parameter you want to adapt. Then COMSOl will interpreste this parameter, redesign xyour geometry, remesh it and solve with the new geometry for each step (this works nicely so long the topology remains unchanged, but might fail if you your parameter changes the topology (i.e. swuare of one size =0 etc) -- 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.