-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resolves 1912: implement nirb tools #1944
Conversation
- define once element space Xh and interpolator - fix docstrings
…into 1912-implement-nirb-tools
…into 1912-implement-nirb-tools
! parallel tests are commented in the file [skip feelpp skip tests skip toolboxes skip mor]
/cc @vincentchabannes [ci skip]
}, | ||
"C_Cpp.configurationWarnings": "Disabled", | ||
"jupyter.notebookFileRoot": "${workspaceFolder}/build/python/install/lib/python3/dist-packages", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prudhomm @vincentchabannes @alielarif I'm not sure this line should stay here : if the preset selected is not python
there is no reason this path should be correct.
The advantage of this setting it that when we run a notebook in vscode, it automatically find the development packages installed in build
directory, so there is no need to set by hand $PYTHONPATH
.
The drawback is that when we launch a kernel, the working directory is no longer the directory where the ipynb file is saved, it is the one set in this line. So it is messy to load the config file (for example in python/pyfeelpp-mor/feelpp/mor/nirb/test_nirb_offline.ipynb, the path is hard coded to a local path "/home/saigre/Documents/code/feelpp/python/pyfeelpp-mor/feelpp/mor/nirb/model/square/square.cfg"
which should have not been pushed, my bad !)
I don't know what would be the best way to set the environment easily : automatically set PYTHONPATH
to the install directory, while the working directory still being the one where the notebook file is saved...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you set this in your user settings and not the workspace setting ?
}, | ||
"C_Cpp.configurationWarnings": "Disabled", | ||
"jupyter.notebookFileRoot": "${workspaceFolder}/build/python/install/lib/python3/dist-packages", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you set this in your user settings and not the workspace setting ?
"cmake.parallelJobs": 5, | ||
"autoDocstring.docstringFormat": "numpy" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why numpy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked at the list available for default docstring format. When the default one is use, the overview of it in vscode is given in the first figure, with numpy, the format is slightly different and the overview is given in the second figure.
I find this is better the second way, but of course we can choose something else !
if self.toolboxType == "heat": | ||
return toolbox.fieldTemperature() | ||
elif self.toolboxType == "fluid": | ||
return toolbox.fieldVelocity() | ||
else: | ||
raise ValueError("Unknown toolbox") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about using a dict to map the function calls ? that way it extends in a nicer way to other toolboxes
if self.toolboxType == "heat": | ||
tb = heat.heat(dim=self.dimension, order=self.order) | ||
elif self.toolboxType == "fluid": | ||
tb = fluid.fluid(dim=self.dimension) | ||
else: | ||
raise ValueError("Unknown toolbox") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about create the toolbox outside ToolboxModel ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will lead to a lot of code changes. Better to do it in an other branch.
if self.toolboxType == "heat": | ||
Vh_image = image_tb.spaceTemperature() | ||
Vh_domain = domain_tb.spaceTemperature() | ||
elif self.toolboxType == "fluid": | ||
Vh_image = image_tb.spaceVelocity() | ||
Vh_domain = domain_tb.spaceVelocity() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not good I think to have this everywhere, if we have to extend this to other toolboxes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A facade needs to be created : please follow this: https://www.geeksforgeeks.org/facade-method-python-design-patterns/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to discuss this before doing any major changes to the code
Bh = self.coeffFine[:nb, :nb] | ||
R = np.zeros((nb,nb)) | ||
for s in range(nb): | ||
R[s,:] = (np.linalg.inv(BH.transpose() @ BH + regulParam*np.eye(nb))@BH.transpose()@Bh[:,s]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid calling .inv
, rather call .solve
with multiple right hand sides, @thomas-saigre
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the correction was made in another branch (in commit 1991f58 on branch 2038-nirb-greedy), we may cherry-pick this commit to put the correction in here
|
||
import sys | ||
|
||
dataPath = "/data/home/elarif/feelppdb/nirb/heat/np_1/results/Rect/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should not be hardcoded, please use feel++ framework and repositories
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we replace this file by a notebook one in the branch #2041. This will be easy to manipulate.
feelpp.Environment.setConfigFile(casefile) | ||
|
||
run_offline(model_path, rect, greedy) | ||
run_online(model_path, rect) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are there any verifications that the results are ok ?
@alielarif @thomas-saigre minor changes are required. |
"cmake.parallelJobs": 5, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I have pussed this by error : I think it was 25
before (too much for my personal laptop), I thought I updated this value only locally, but it seems that it commited anyway, sorry about that.
Shall we change it back ?
# (('testcase/nirb/lid-driven-cavity/', 'cfd2d.cfg', 'cfd2d.json', True) , 'lid-driven-cavity rect'), | ||
(('testcase/nirb/square', 'square.cfg', 'square.json', False, False), 'square2d w/o rect wogreedy'), | ||
(('testcase/nirb/square', 'square.cfg', 'square.json', True, False) , 'square2d rect wogreedy'), | ||
(('testcase/nirb/square', 'square.cfg', 'square.json', True, True) , 'square2d rect egreedy'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the test with Greedy selection dosn't get an error less than 8.10-2. I remove it now by waiting its new version.
…into 1912-implement-nirb-tools
This is not working in parallel yet
[skip feelpp skip tests skip toolboxes skip mor]