Пример #1
0
## [literature data][1]
## [1]: http://dx.doi.org/10.1002/(SICI)1097-4628(19961017)62:3<567::AID-APP14>3.0.CO;2-W
par3 = [3.32e-8, 42.9e3, 2.32, 1.4, X_gel]

## based on [literature data](http://dx.doi.org/10.1002/aic.690280213), but
## gel point changed to 0.5 (Baser and Khakhar)
par4 = [4.1e-8, 38.3e3, 4.0, -2.0, X_gel]

## [literature data](http://doi.wiley.com/10.1002/aic.12002)
par5 = [3.1e0, 2.24e3, 3.5, -2.0, X_gel]

## [literature data](http://doi.wiley.com/10.1002/pen.760311605)
par6 = [1.6e-7, 44.9e3, 1.29, 1.86, X_gel]

## based on BASF data for 100 s^-1 shear rate, you must use 0.5 for gel point
par7 = [2.49707805e-13, 6.88758966e+04, 1.03553549e+01, -1.46554648e+01, 0.5]

## based on BASF data for 1 s^-1 shear rate, you must use 0.5 for gel point
par8 = [7.03759789e-17, 8.91382466e+04, 1.32209736e+01, -1.82153953e+01, 0.5]

## Surrogate model for polymer viscosity
#
# Forward mapping model is used.
m_polymerViscosity = ForwardMappingModel(
    _id='polymerViscosity',
    surrogateFunction=f_polymerViscosity,
    substituteModels=[],
    parameters=par,
)
Пример #2
0
            'min': -9e99,
            'max': +9e99,
            'argPos': 1
        },
    },
    indices={
        'A': species,
    },
)

## Surrogate model for thermal conductivity of blowing agent
#
# Forward mapping model is used.
m_CO2_thermal_conductivity = ForwardMappingModel(
    _id='gas_thermal_conductivity[A=CO2]',
    surrogateFunction=f_gas_thermal_conductivity,
    substituteModels=[],
    parameters=[0.0807e-3, -6.96e-3],
)

## Surrogate model for thermal conductivity of blowing agent
#
# Forward mapping model is used.
m_Air_thermal_conductivity = ForwardMappingModel(
    _id='gas_thermal_conductivity[A=Air]',
    surrogateFunction=f_gas_thermal_conductivity,
    substituteModels=[],
    parameters=[0.0720e-3, 4.23e-3],
)

## Surrogate model for thermal conductivity of blowing agent
#
Пример #3
0
    Modena is distributed in the hope that it will be useful, but WITHOUT ANY
    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    details.

    You should have received a copy of the GNU General Public License along
    with Modena.  If not, see <http://www.gnu.org/licenses/>.
@endcond'''
"""
@ingroup mod_kinetics
@namespace Kinetics.Kinetics
@todo      Document
@author    Andreas Daiss
@copyright 2014-2016, MoDeNa Project. GNU Public License.
@ingroup   app_foaming
"""

import os
from modena import ForwardMappingModel
from PrediciKinetics import PrediciKinetics

k = PrediciKinetics(
    _id='RF-1-public',
    fileName=os.path.dirname(os.path.abspath(__file__)) + '/RF-1-public.c',
)

m = ForwardMappingModel(_id='RF-1-public',
                        surrogateFunction=k,
                        substituteModels=[],
                        importFrom='Kinetics.PrediciKinetics')
Пример #4
0
    const double* inputs,
    double *outputs
)
{
    {% block variables %}{% endblock %}

    const double R = parameters[0];

    outputs[0] = p0/R/T0;
}
''',
    # These are global bounds for the function
    inputs={
        'p0': { 'min': 0, 'max': 9e99 },
        'T0': { 'min': 0, 'max': 9e99 },
    },
    outputs={
        'rho0': { 'min': 9e99, 'max': -9e99, 'argPos': 0 },
    },
    parameters={
        'R': { 'min': 0.0, 'max': 9e99, 'argPos': 0 }
    },
)

m = ForwardMappingModel(
    _id= 'idealGas',
    surrogateFunction= f,
    substituteModels= [ ],
    parameters= [ 287.0 ],
)
Пример #5
0
    parameters={
        'R': { 'min': 0.0, 'max': 9e99, 'argPos': 0 }
    },
)

m1 = ForwardMappingModel(
    _id= 'idealGas',
    #exactTask= Strategy.InitialDataPoints(),
    surrogateFunction= f2,
    substituteModels= [ ],
    parameters= [ 287.0 ],
    inputs={
        'p0': { 'min': 0, 'max': 9e99 },
        'T0': { 'min': 0, 'max': 9e99 },
    },
    outputs={
        'rho0': {'min': 0, 'max': 9e99 },
    },
    initialisationStrategy= Strategy.InitialData(
        initialData={
        'p0' : [1,2,3,4,5],
        'T0' : [296,297,298,299,300],
        'rho0' : [0.000011771353234, 0.00002346343809758, 0.00003507705259219, 0.00004661298404, 0.0000580720092915],
        },
    ),
)

m2 = BackwardMappingModel(
    _id= 'idealGasBackward',
    exactTask= Strategy.InitialDataPoints(),
    surrogateFunction= f1,
Пример #6
0
    parameterFittingStrategy=parameterFittingStrategy)
m_solubilityCyclopentanePU = BackwardMappingModel(
    _id='Solubility[A=CyP,B=2]',
    surrogateFunction=f2,
    exactTask=SolubilityExactSim(),
    substituteModels=[],
    initialisationStrategy=Strategy.InitialPoints(initialPoints={
        'T': [270, 320, 370, 420],
        'xl1': [1.1e-3, 1.0e-3, 1.0e-3, 1.0e-4],
        'xl2': [0.9989, 0.999, 0.999, 0.9999],
    }, ),
    outOfBoundsStrategy=outOfBoundsStrategy,
    parameterFittingStrategy=parameterFittingStrategy)
m_solubilityOptPU = ForwardMappingModel(
    _id='Solubility[A=Opt,B=2]',
    surrogateFunction=f2,
    substituteModels=[],
    parameters=[10.0, -0.0182038808728673, 0.0],
)
m_solubilitySolPU = ForwardMappingModel(
    _id='Solubility[A=Sol,B=2]',
    surrogateFunction=f2,
    substituteModels=[],
    parameters=[10.0, -0.0182038808728673, 0.0],
)
m_solubilityO2PU = BackwardMappingModel(
    _id='Solubility[A=O2,B=2]',
    surrogateFunction=f2,
    exactTask=SolubilityExactSim(),
    substituteModels=[],
    initialisationStrategy=Strategy.InitialPoints(initialPoints={
        'T': [270, 320, 370, 420],
Пример #7
0
    'param0': { 'min': 1e-12, 'max': 1E1, 'argPos': 0 },
    'param1': { 'min': -1e-1, 'max': 1e-1, 'argPos': 1 },
    'param2': { 'min': -1e-1, 'max': 1e-1, 'argPos': 2 },
    'param3': { 'min': -1e-1, 'max': 1e-1, 'argPos': 3 },
}
fR11Baser = CFunction(Ccode=CcodeR11Baser,
    inputs=inputsExp,
    outputs=outputs,
    parameters=parameters4
)
## [R11, Baser](http://dx.doi.org/10.1002/pen.760340804)
parR11Baser = [1e-7, 4.2934, 203.3556, 40.016]
m_solubilityR11Baser = ForwardMappingModel(
    _id='SolubilityR11Baser',
    surrogateFunction=fR11Baser,
    substituteModels=[],
    parameters=parR11Baser,
    inputs=inputsExp,
    outputs=outputs,
)
CcodeCO2Baser='''
#include "modena.h"
#include "math.h"

void surroSolubilityCO2Baser
(
const modena_model_t* model,
const double* inputs,
double *outputs
)
{
{% block variables %}{% endblock %}
Пример #8
0
    # These are global bounds for the function
    inputs={
        'T': {'min': 273, 'max': 550},
    },
    outputs={
        'polymer_thermal_conductivity': {
            'min': 0, 'max': +9e99, 'argPos': 0
        },
    },
    parameters={
        'param0': {'min': -9e99, 'max': +9e99, 'argPos': 0},
        'param1': {'min': -9e99, 'max': +9e99, 'argPos': 1},
    },
)

## Surrogate model for thermal conductivity of polyurethane
#
# Forward mapping model is used.
m_polymer_thermal_conductivity = ForwardMappingModel(
    _id='polymer_thermal_conductivity',
    surrogateFunction=f_polymer_thermal_conductivity,
    substituteModels=[],
    parameters=[0.198e-3, 131.08e-3],
    inputs={
        'T': {'min': 273, 'max': 450},
    },
    outputs={
        'polymer_thermal_conductivity': {'min': 0, 'max': +9e99},
    },
)
Пример #9
0
            'max': +9e99,
            'argPos': 3
        },
    },
)
## Surrogate model for density_reaction_mixture
#
# Forward mapping model is used.
m = ForwardMappingModel(
    _id='density_reaction_mixture',
    surrogateFunction=f,
    substituteModels=[],
    parameters=[-0.0006, 1287.8, -0.000048, 992.8],
    inputs={
        'T': {
            'min': 273,
            'max': 450
        },
        'XOH': {
            'min': 0,
            'max': 1
        },
    },
    outputs={
        'density_reaction_mixtureSM': {
            'min': 0,
            'max': 8000.0
        },
    },
)
Пример #10
0
            'min': -9e99,
            'max': +9e99,
            'argPos': 0
        },
        'C2': {
            'min': -9e99,
            'max': +9e99,
            'argPos': 1
        },
    },
)

# -------------------------- Surrogate Models ------------------------------- #
m_forward = ForwardMappingModel(
    _id='FoamElasticModulus',
    surrogateFunction=f_ludwigshafen,
    substituteModels=[],
    parameters=[0, 1],  # TODO: Use real values from Ludwigshafen presentation
)

m_backward = BackwardMappingModel(
    _id='FoamElasticModulus_TEST',
    surrogateFunction=f_backward,
    exactTask=MechanicalPropertiesExactSim(),
    substituteModels=[],
    initialisationStrategy=Strategy.InitialData(
        initialData={
            'rho': [
                30.2, 60, 120, 240, 30.2, 60, 120, 240, 30.2, 30.2, 30.2, 30.2,
                30.2, 30.2, 30.2
            ],
            'strut_content': [
Пример #11
0
        },
    },
    parameters={
        'param0': {
            'min': -9e99,
            'max': +9e99,
            'argPos': 0
        },
        'param1': {
            'min': -9e99,
            'max': +9e99,
            'argPos': 1
        },
        'param2': {
            'min': -9e99,
            'max': +9e99,
            'argPos': 2
        },
    },
)

## Surrogate model for density_reaction_mixture
#
# Forward mapping model is used.
m = ForwardMappingModel(
    _id='strutContent',
    surrogateFunction=f,
    substituteModels=[],
    parameters=[0.06115509, -0.72513392, 1.],
)
Пример #12
0
            'min': -9e99,
            'max': +9e99,
            'argPos': 0
        },
        'param1': {
            'min': 0.0,
            'max': +9e99,
            'argPos': 1
        },
        'param2': {
            'min': -9e99,
            'max': +9e99,
            'argPos': 2
        },
        'param3': {
            'min': 0.0,
            'max': +9e99,
            'argPos': 3
        },
    },
)
## Surrogate model for density_reaction_mixture
#
# Forward mapping model is used.
m = ForwardMappingModel(
    _id='density_reaction_mixture',
    surrogateFunction=f,
    substituteModels=[],
    parameters=[-0.0006, 1287.8, -0.000048, 992.8],
)
Пример #13
0
## based on [literature data](http://dx.doi.org/10.1002/aic.690280213), but
## gel point changed to 0.5 (Baser and Khakhar)
par4 = [4.1e-8, 38.3e3, 4.0, -2.0, 0.5]

## Surrogate model for polymer viscosity
#
# Forward mapping model is used.
m_polymerViscosity = ForwardMappingModel(
    _id='polymerViscosity',
    surrogateFunction=f_polymerViscosity,
    substituteModels=[],
    parameters=par4,
    inputs={
        'T': {
            'min': 200,
            'max': 450
        },
        'X': {
            'min': 0,
            'max': 1
        },
    },
    outputs={
        'mu': {
            'min': 0,
            'max': +9e99
        },
    },
)
Пример #14
0
        },
    },
    parameters={
        'param0': {
            'min': -9e99,
            'max': +9e99,
            'argPos': 0
        },
        'param1': {
            'min': -9e99,
            'max': +9e99,
            'argPos': 1
        },
        'param2': {
            'min': -9e99,
            'max': +9e99,
            'argPos': 2
        },
    },
)

## Surrogate model for thermal conductivity of mixture of blowing agents
#
# Forward mapping model is used.
m_gasMixtureConductivity = ForwardMappingModel(
    _id='gasMixtureConductivity',
    surrogateFunction=f_gasMixtureConductivity,
    substituteModels=gasConductivity.substituteModels,
    parameters=[1, 1, 1],
)
Пример #15
0
        'diffusivity': {'min': 0, 'max': +9e99, 'argPos': 0},
    },
    parameters={
        'param0[A]': {'min': 0.0, 'max': +9e99, 'argPos': 0},
        'param1[A]': {'min': 0.0, 'max': +9e99, 'argPos': 1},
    },
    indices={
        'A': species,
    },
)
## Surrogate model for diffusivity
#
# Forward mapping model is used.
m_CO2_diffusivity = ForwardMappingModel(
    _id='diffusivityPol[A=CO2]',
    surrogateFunction=f_diffusivity,
    substituteModels=[],
    parameters=[0.00123, 6156],
)
## Surrogate model for diffusivity
#
# Forward mapping model is used.
m_CyP_diffusivity = ForwardMappingModel(
    _id='diffusivityPol[A=CyP]',
    surrogateFunction=f_diffusivity,
    substituteModels=[],
    parameters=[1.7e-7, 4236],
)
## Surrogate model for diffusivity
#
# Forward mapping model is used.
m_N2_diffusivity = ForwardMappingModel(
Пример #16
0
            'min': -9e99,
            'max': +9e99,
            'argPos': 1
        },
    },
    indices={
        'A': species,
    },
)

## Surrogate model for thermal conductivity of blowing agent
#
# Forward mapping model is used.
m_CO2_thermal_conductivity = ForwardMappingModel(
    _id='gas_thermal_conductivity[A=CO2]',
    surrogateFunction=f_gas_thermal_conductivity,
    substituteModels=[],
    parameters=[0.0807e-3, -6.96e-3],
)

## Surrogate model for thermal conductivity of blowing agent
#
# Forward mapping model is used.
m_Air_thermal_conductivity = ForwardMappingModel(
    _id='gas_thermal_conductivity[A=Air]',
    surrogateFunction=f_gas_thermal_conductivity,
    substituteModels=[],
    parameters=[0.0720e-3, 4.23e-3],
)

## Surrogate model for thermal conductivity of blowing agent
#
Пример #17
0
    Ccode=weightedAverageCode,
    # These are global bounds for the function
    inputs={
        'T': {'min': 273, 'max': 550},
        'x': {'index': gasConductivity.species, 'min': 0, 'max': 1},
        'gas_thermal_conductivity': {'index': gasConductivity.species,
            'min': 0, 'max': 1},
    },
    outputs={
        'gasMixtureConductivity': {'min': 0, 'max': +9e99, 'argPos': 0},
    },
    parameters={
        'param0': {'min': -9e99, 'max': +9e99, 'argPos': 0},
        'param1': {'min': -9e99, 'max': +9e99, 'argPos': 1},
        'param2': {'min': -9e99, 'max': +9e99, 'argPos': 2},
    },
)

## Surrogate model for thermal conductivity of mixture of blowing agents
#
# Forward mapping model is used.
m_gasMixtureConductivity = ForwardMappingModel(
    _id='gasMixtureConductivity',
    surrogateFunction=f_gasMixtureConductivity,
    substituteModels=[gasConductivity.m_CO2_thermal_conductivity,\
                      gasConductivity.m_CyP_thermal_conductivity,\
                      gasConductivity.m_O2_thermal_conductivity,\
                      gasConductivity.m_N2_thermal_conductivity],
    parameters=[1, 1, 1],
)
Пример #18
0
#include "math.h"

void fullerEtAlDiffusion
(
    const modena_model_t* model,
    const double* inputs,
    double *outputs
)
{
    {% block variables %}{% endblock %}

    const double WA = parameters[0];
    const double VA = parameters[1];
    const double WB = parameters[2];
    const double VB = parameters[3];

    outputs[0] = 1.011e-4*pow(T, 1.75)*pow(1.0/WA + 1.0/WB, 1.0/2.0);
    outputs[0] /= p*(pow(pow(VA, 1.0/3.0) + pow(VB, 1.0/3.0), 2.0));
}
''',
)

m = ForwardMappingModel(
    _id= 'fullerEtAlDiffusion[A=H2O,B=N2]',
    surrogateFunction= f,
    substituteModels= [ ],
    parameters= [ 16, 9.44, 14, 11.38 ],
)


Пример #19
0
    mu_ap = mu_car * f_t;
    // printf("apparent viscosity %f", mu_ap);
    outputs[0] = mu_ap;
}
''',
   inputs={
       'T': {'min': 0, 'max': 9e99 },
       'shear': {'min': 0, 'max': 9e99 },
       'X': {'min': 0, 'max': 1 },
       'm0' : {'min': 0, 'max' : 9e99},
       'm1' : {'min': 0, 'max' : 9e99},
       'mu' : {'min': 0, 'max' : 9e99},
       'ST' : {'min': 0, 'max' : 9e99},
       'mu_car' : {'min': 0, 'max' : 9e99},
   },
   outputs={
       'mu_ap': { 'min': 0, 'max': 9e99, 'argPos': 0 },
   },
   parameters={
       'Rgas' : {'min': 8.31, 'max': 8.32, 'argPos': 0},
   }
)


m = ForwardMappingModel(
    _id='Rheology_Arrhenius',
    surrogateFunction=f,
    substituteModels=[ Rheology.m ],
    parameters=[ 8.314 ],
)