MoDeNa-EUProject / MoDeNa

Software Framework for MOdelling of morphology DEvelopment of micro- and NAnostructures (MoDeNa)
17 stars 19 forks source link

backward mapping issue! #43

Closed karimimp closed 8 years ago

karimimp commented 8 years ago

Christos and I trying to have a backward mapping working. The issue is that the framework requires the return value of modena_error() call to realize that the surrogate model is out of bounds. So, it can call the detailed model. Since in the 0D code the call to the surrogate model has been done within a void function, then we cannot have a return value. Is there a way to overcome this issue?

karimimp commented 8 years ago

The issue is not fixed, however we call the rheology surrogate model within the main function to only see the output of modena_error() we get the return code = 200 and the following error message:

return code = 200
Performing Design of Experiments
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/fireworks/core/rocket.py", line 202, in run
    m_action = t.run_task(my_spec)
  File "/home/mohsen/lib/python2.7/site-packages/modena/Strategy.py", line 813, in run_task
    return self.handleReturnCode(ret.stored_data['returncode'])
  File "/home/mohsen/lib/python2.7/site-packages/modena/Strategy.py", line 757, in handleReturnCode
    outsidePoint= model.outsidePoint
  File "/home/mohsen/lib/python2.7/site-packages/modena/Strategy.py", line 167, in workflow
    wf = model.exactTasks(self.newPoints(model, **kwargs))
  File "/home/mohsen/lib/python2.7/site-packages/modena/SurrogateModel.py", line 926, in exactTasks
    et = load_object(self.meth_exactTask)
  File "/usr/local/lib/python2.7/dist-packages/fireworks/utilities/fw_serializers.py", line 294, in load_object
    mod = __import__(modname, globals(), locals(), [classname], 0)
ImportError: No module named flowRate

and we are not sure why it looks for flowRate !

henrus commented 8 years ago

Hi Mohsen, your first question is basically about managing errors within the subroutines of an application. Here, the classical way is to pass error codes around - either as return values, through the signature or global variables. Modern languages such as C++ provide exception handling to simplify this, but we are restricted to C. MoDeNa's error handling framework uses a global variable which is not reset if you query it through modena_error_occurred(). This allows you to back-off (return) from functions and deal with errors upstream. Would this work for you? Henrik

henrus commented 8 years ago

Hi Mohsen, as for the second question. Can you please point me to an example where I can reproduce the problem. Henrik

karimimp commented 8 years ago

Hi Henrik, Thanks for the reply. For the first one I need a bit of time to digest and understand, I guess I get the general idea, though.

For the second one, on the MODENA private repo, master branch:

cd Modena/applications/PUfoam/Rheology_Tool/
./initModels_rh
cd Modena/applications/PUfoam/CFD_tool/0D/modenaInterface
cmake .
make
./workflow

now I've added modena_error_occurred() and print the error code modena_error() on the screen. So I think you should be able to see the error code 200.