MoDeNa-EUProject/MoDeNa

How to create models with outputs that depend on a parameter

Opened this issue · 5 comments

For the Solubility model, the user should eventually be able to specify something like this in his macroscopic code:

...
system1 = ["co2", "MDI", "Polyol"]
call Solubility(T,system1)
system2 = ["Pentane", "MDI", "Polyol"]
call Solubility(T,system2)
...

The first call to the solubility model should return the Henry Coefficient of CO2 in a system containing CO2, MDI and Polyol. The second call should return the Henry Coefficient for Pentane.

In order to do this, the solubility model needs parameters and outputs which depend on an index specifying which component the solubility should be calculated for (here "CO2" or "Pentane"), i.e. it should look something like this:

...
outputs={
'H[A]': { 'min': 9e99, 'max': -9e99, 'argPos': 0 },
},
parameters={
'param0[A]': { 'min': -1E10, 'max': 1E10, 'argPos': 0 },
'param1[A]': { 'min': -1E10, 'max': 1E10, 'argPos': 1 },
'param2[A]': { 'min': -1E10, 'max': 1E10, 'argPos': 2 },
},
indices={
'A': species,
},
...

where 'A' could be "CO2" or "Pentane" in this example.
Is this possible?

Hi Jonas,
I understand what you are after and we need to find a way to deal with this in a systematic manner. One problem that I see is that you defined two index sets (system1, system2) and then use none of them in function specification where you simply say ('A': species). The second (related) problem is that you re-define the index set depending on whether you want to calculate CO2 or Pentane in mixture of MDI and Polyol. My feeling is that the index set actually wants to be

species = ["CO2", "Pentane", "MDI", "Polyol"]

ie. a list of all species present in the system.

Note: I am aware that the presence of Pentane is neglected when calculating the soluability of CO2 and vice versa. Guess all we need now is a way to tell the function that some species are neglected while others are not.
Please give me a sign whether this makes sense to you,
Henrik

Hi Jonas,
please have a look into the substituteModels2 branch. Does something like what is in

applications/PUfoam/Models/gasMixtureConductivity/gasMixtureConductivity.py

work for you?

Hi Henrik,

where do I find branch substitueModel2. Once I cloned the current repo from
gitHub I only found the branches gh-pages, master, nextRelease and
modelModules.

Regards,
Jonas

On Mon, Dec 7, 2015 at 2:40 PM, Henrik Rusche notifications@github.com
wrote:

Hi Jonas,
please have a look into the substituteModels2 branch. Does something like

applications/PUfoam/Models/gasMixtureConductivity/gasMixtureConductivity.py

work for you?


Reply to this email directly or view it on GitHub
#27 (comment)
.

Try

git branch -a

to see remote branches. Then

git checkout -b substituteModels2

Hi Henrik,

ok, now I found the branch and the module.
This will work for me, if the the single substitue models can pass the
information "who they are" to the detailed model, i.e. the detailed model
has to know whether it was called by the gasConductivity.m_CO2 model or
gasConductivity.m_CyP. But I guess this can easily be done by an additional
input parameter which only reads 'CO2', 'CyP', ....

Besides that, with array for the concentrations and the possibility to have
distinct surrogate models via the substitue models all necessary
information for our model can be passed.

Regards,
Jonas

On Wed, Dec 9, 2015 at 4:15 PM, Henrik Rusche notifications@github.com
wrote:

Try

git branch -a
to see remote branches. Then
git checkout -b substituteModels2


Reply to this email directly or view it on GitHub
#27 (comment)
.