diff --git a/applications/PUfoam/MoDeNaModels/Rheology/Example_WorkflowIntegration/initModels_rh b/applications/PUfoam/MoDeNaModels/Rheology/Example_WorkflowIntegration/initModels_rh
index 940950e18..f1db8360a 100755
--- a/applications/PUfoam/MoDeNaModels/Rheology/Example_WorkflowIntegration/initModels_rh
+++ b/applications/PUfoam/MoDeNaModels/Rheology/Example_WorkflowIntegration/initModels_rh
@@ -44,13 +44,13 @@ from modena import SurrogateModel, Workflow2, MODENA_PARSED_URI
from fireworks import LaunchPad
from fireworks.core.rocket_launcher import rapidfire
-import Rheology
+import Rheology_Arrhenius
# set up the LaunchPad and reset it
launchpad = LaunchPad(**MODENA_PARSED_URI)
launchpad.reset('', require_password=False)
-m = Rheology.m
+m = Rheology_Arrhenius.m
initWfs = m.initialisationStrategy().workflow(m)
# store workflow and launch it locally
diff --git a/applications/PUfoam/MoDeNaModels/Rheology/Example_WorkflowIntegration/src_dummy/workflowdummy b/applications/PUfoam/MoDeNaModels/Rheology/Example_WorkflowIntegration/src_dummy/workflowdummy
new file mode 100755
index 000000000..550520eac
Binary files /dev/null and b/applications/PUfoam/MoDeNaModels/Rheology/Example_WorkflowIntegration/src_dummy/workflowdummy differ
diff --git a/applications/PUfoam/MoDeNaModels/Rheology/Example_WorkflowIntegration/src_dummy/workflowdummy.f90 b/applications/PUfoam/MoDeNaModels/Rheology/Example_WorkflowIntegration/src_dummy/workflowdummy.f90
index 5ac96e94b..e69d40f3e 100644
--- a/applications/PUfoam/MoDeNaModels/Rheology/Example_WorkflowIntegration/src_dummy/workflowdummy.f90
+++ b/applications/PUfoam/MoDeNaModels/Rheology/Example_WorkflowIntegration/src_dummy/workflowdummy.f90
@@ -13,7 +13,12 @@ program workflowdummy
type(c_ptr) :: Model, Inputs, Outputs
print*, "Hello World"
Model = modena_model_new (c_char_"Rheology_Arrhenius"//c_null_char);
- print*, "asdf"
+
+ if ( modena_error_occurred() ) then
+ call exit( modena_error() )
+ end if
+
+ print*, "Check Complete"
Inputs = modena_inputs_new (Model);
Outputs = modena_outputs_new (Model);
TPos = modena_model_inputs_argPos(Model, &
@@ -31,8 +36,9 @@ program workflowdummy
! viscosityConvPos = modena_model_inputs_argPos(viscosityModel, &
! c_char_"X"//c_null_char);
- call modena_model_argPos_check(Model)
+! call modena_model_argPos_check(Model)
+ print*, "Argpos"
! call modena_model_argPos_check(viscosityModel)
diff --git a/applications/PUfoam/MoDeNaModels/Rheology/Rheology.py b/applications/PUfoam/MoDeNaModels/Rheology/Rheology.py
index 3a94c0045..99f5e200b 100644
--- a/applications/PUfoam/MoDeNaModels/Rheology/Rheology.py
+++ b/applications/PUfoam/MoDeNaModels/Rheology/Rheology.py
@@ -73,7 +73,7 @@ def task(self, fw_spec):
# Execute the detailed model
- ret = os.system('../src/rheologyexactdummy')
+ ret = os.system(os.path.dirname(os.path.abspath(__file__)) + '/src/rheologyexactdummy')
# This enables backward mapping capabilities (not needed in this example)
self.handleReturnCode(ret)
diff --git a/applications/PUfoam/MoDeNaModels/Rheology_Arrhenius/Rheology_Arrhenius.py b/applications/PUfoam/MoDeNaModels/Rheology_Arrhenius/Rheology_Arrhenius.py
new file mode 100644
index 000000000..3e111d8c4
--- /dev/null
+++ b/applications/PUfoam/MoDeNaModels/Rheology_Arrhenius/Rheology_Arrhenius.py
@@ -0,0 +1,110 @@
+'''
+
+ ooo ooooo oooooooooo. ooooo ooo
+ `88. .888' `888' `Y8b `888b. `8'
+ 888b d'888 .ooooo. 888 888 .ooooo. 8 `88b. 8 .oooo.
+ 8 Y88. .P 888 d88' `88b 888 888 d88' `88b 8 `88b. 8 `P )88b
+ 8 `888' 888 888 888 888 888 888ooo888 8 `88b.8 .oP"888
+ 8 Y 888 888 888 888 d88' 888 .o 8 `888 d8( 888
+ o8o o888o `Y8bod8P' o888bood8P' `Y8bod8P' o8o `8 `Y888""8o
+
+Copyright
+ 2014 MoDeNa Consortium, All rights reserved.
+
+License
+ This file is part of Modena.
+
+ Modena is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ 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 .
+
+Description
+ Python library of FireTasks
+
+Authors
+ Henrik Rusche
+
+Contributors
+ Christos Mitrias
+'''
+
+import os
+import modena
+import SurfaceTension, polymerViscosity
+import Rheology
+from modena import ForwardMappingModel, BackwardMappingModel, SurrogateModel, CFunction, ModenaFireTask
+import modena.Strategy as Strategy
+from fireworks.user_objects.firetasks.script_task import FireTaskBase, ScriptTask
+from fireworks import Firework, Workflow, FWAction
+from fireworks.utilities.fw_utilities import explicit_serialize
+from jinja2 import Template
+
+
+__author__ = 'Henrik Rusche'
+__copyright__ = 'Copyright 2014, MoDeNa Project'
+__version__ = '0.2'
+__maintainer__ = 'Henrik Rusche'
+__email__ = 'h.rusche@wikki.co.uk.'
+__date__ = 'Sep 4, 2014'
+
+f = CFunction(
+ Ccode= '''
+#include "modena.h"
+#include "math.h"
+#include
+
+void Arrhenius
+(
+ const modena_model_t* model,
+ const double* inputs,
+ double *outputs
+)
+{
+ {% block variables %}{% endblock %}
+
+ const double A_mu = 0.0387; // could be loaded from some library for consistence
+ const double E_mu = 10000;
+ const double R_rh = 8.314;
+
+ double f_t, mu_ap;
+
+ f_t = A_mu * exp(E_mu / R_rh / T );
+
+ mu_ap = mu_inf * 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 },
+ 'mu' : {'min': 0, 'max' : 9e99},
+ 'ST' : {'min': 0, 'max' : 9e99},
+ 'mu_inf' : {'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 ],
+)
+
diff --git a/applications/PUfoam/MoDeNaModels/SurfaceTension/SurfaceTension.py b/applications/PUfoam/MoDeNaModels/SurfaceTension/SurfaceTension.py
index 6e365c62c..0b79ef60a 100644
--- a/applications/PUfoam/MoDeNaModels/SurfaceTension/SurfaceTension.py
+++ b/applications/PUfoam/MoDeNaModels/SurfaceTension/SurfaceTension.py
@@ -80,12 +80,12 @@
blowing_agents = IndexSet(
name= 'blowing_agents',
- names= [ 'air', 'CO2']
+ names= [ 'AIR', 'CO2']
)
monomers = IndexSet(
name = 'monomers',
- names = ['PU', 'THF', 'hexane']
+ names = ['PU', 'THF', 'HEXANE']
)
diff --git a/src/python/Strategy.py b/src/python/Strategy.py
index c9d888461..6dbb09b0a 100644
--- a/src/python/Strategy.py
+++ b/src/python/Strategy.py
@@ -184,6 +184,13 @@ def workflow(self, model):
wf = model.exactTasks(p)
wf.addAfterAll(model.parameterFittingStrategy().workflow(model))
return wf
+
+ elif not len(p) and len(model.substituteModels):
+ wf = Workflow2([])
+ for sm in model.substituteModels:
+ wf.addNoLink(sm.initialisationStrategy().workflow(sm))
+ return wf
+
else:
return Workflow2([])
diff --git a/src/python/SurrogateModel.py b/src/python/SurrogateModel.py
index 46beb62e4..c7ea1589e 100644
--- a/src/python/SurrogateModel.py
+++ b/src/python/SurrogateModel.py
@@ -1216,13 +1216,13 @@ def loadFromModule(self):
collection = self._get_collection()
doc = collection.find_one({ '_cls': { '$exists': False}})
modName = re.search('(.*)(\[.*\])?', doc['_id']).group(1)
- #TODO: This solution still requires the user to give the modena
- # application the same name as the surrogate model '_id'
+ # TODO:
+ # Give a better name to the variable a model is imported from
try:
mod = __import__(modName)
- return (i for i in modena.BackwardMappingModel.get_instances() if i._id == modName).next()
+ return (m for m in modena.BackwardMappingModel.get_instances() if m._id == modName).next()
except ImportError:
- print "Could not find MoDeNa model '%s'" %(modName)
+ print "MoDeNa framework error: could not find '%s' " %(modName)
@classmethod
def get_instances(self):