-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
OpenFOAM CalculiX XY (issue#34) #92
Conversation
Thank you very very much, @alphaoo! I think it would be a good idea to actually change the files of the current tutorial, since this is a better default. For people that have already built their cases based on the current orientation, this PR would be a clear indication of what they could change. Moreover, it would make reviewing easier, as we could see the changes only. If anybody still wants to use the previous case, it is always available on GitHub. @uekerman I vote for replacing the current case instead of adding a new one. What do you think? @Eder-K this will also then need an update in the reference results of the system tests. |
Yes, replacing is better than a new one. Is this only for |
Yes, this affects also the other cases and we should gradually port them as well. For deal.II it will be easy, for SU2 we would need help (maybe a nice first contribution for anyone interested in precice/su2-adapter#16). |
I have added the OpenFOAM+CalculiX CHT case, which have some issues from CalculiX side. I have adapted the CHT part similar to the heat-exchanger case. I am currently working on making a flow over the heat plate case similar to OF+Nutils. I will push as soon as I am done, working towards Issue #103 . |
This pull request has been mentioned on preCICE Forum on Discourse. There might be relevant details there: https://precice.discourse.group/t/precice-mesh-id-1-error-openfoam-calculix-cht/313/9 |
Thank you very much for contributing, @Alphaoo1! Could you please split this PR to a different one for each tutorial? This would make the review much easier. Otherwise, this may stay an open PR for too long. |
@MakisH Yes. No Problem. |
@Alphaoo1 could you please also remove all the result files? You can keep a screenshot in the README to help users understand what this is about, but currently this PR has way too many files to start reviewing it. You can have a look at the files changed tab, where I would like to be able to browse the code and add comments. Thank you for keeping this up to date all this time! 😃 |
@MakisH I have tried to clean up all the things I could think of. You might find that there are copies of Let me know if I need to do something else. 😄 |
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.
Congratulations of your first preCICE PR review! 🥳
Thank you very much for all the work, please look through my comments and try to apply all the suggestions, if possible, to make this case consistent with the rest of the preCICE tutorials.
See also a separate detailed comment in the discussion, but in this review my main points are:
- Change the approach from Salome-based mesh generation to OpenFOAM/CalculiX-native rotation at preprocessing time.
- Remove some non-relevant changes.
- Move the interFoam-based tutorial to a different PR, preferably after applying the results from our discussion here.
@@ -0,0 +1,86 @@ | |||
solid |
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 guess we can remove all the new files in CHT/flow-over-plate/buoyantPimpleFoam-nutils/
.
@@ -68,7 +68,7 @@ Solver2="ccx_preCICE" | |||
cd ${Participant2} | |||
# We use CalculiX CGX to setup the structural simulation | |||
echo " Executing cgx (provided by CalculiX, make sure this exists)..." | |||
cgx -bg pre_flap.fbd > prepare_flap.log 2>&1 | |||
# cgx -bg pre_flap.fbd > prepare_flap.log 2>&1 |
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 has now been removed in #95. Please merge.
cd constant | ||
cp -rfv polyMesh_backup polyMesh | ||
cd .. |
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.
See detailed comment in the conversation: let's not copy an already created mesh, but add the steps to rotate the created mesh into the run scripts.
# rm -fv *.nam | ||
# rm -fv *.msh |
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 keeping these files? Similarly to the OpenFOAM files, let's add the rotation commands to the run scripts.
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 keeping these files?
As we have pre_flap.fbd
in the original tutorial case, it has commands to export the .nam
and .msh
files. But in this case, I had to do it manually. The commands are the same but I haven't yet figured out how to write a script to export all these files.
Similarly to the OpenFOAM files, let's add the rotation commands to the run scripts.
CalculiX does not rotate around the same point as OpenFOAM, and ultimately we have a bit mismatching meshes.
(one does rotation around the origin and the other does rotation around a corner, but I don't remember now which is which).
It was easier for me to just create new geometry and new mesh in Salome. 😅
But yes, Salome workflow might not be fitting to everyone.
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.
Probably the Salome workflow would be a quite pragmatic approach: many users use it anyway. However, we try to keep the dependencies of the tutorials to a minimum (preCICE already has too many dependencies and components). In any case, this is a tutorial to learn how to use preCICE and its adapters, not how to make a perfect FSI simulation.
What if we just rotate the CalculiX case by hand, e.g. using the Salome output as an example?
@@ -32,7 +32,7 @@ Participant1="Fluid" | |||
cd .. | |||
|
|||
echo " Preparing the mesh..." | |||
blockMesh -case ${Participant1} > ${Participant1}_blockMesh.log 2>&1 | |||
# blockMesh -case ${Participant1} > ${Participant1}_blockMesh.log 2>&1 |
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 want to keep the mesh generation with blockMesh. After this line, we also need to rotate the mesh.
@@ -0,0 +1,62 @@ | |||
#!/bin/sh |
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.
Please move the FSI/flap_perp/OpenFOAM-CalculiX_interFoam/
into a separate PR.
@@ -0,0 +1,54 @@ | |||
/*--------------------------------*- C++ -*----------------------------------*\ |
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.
Is this a temporary backup file?
@@ -0,0 +1,97 @@ | |||
/*--------------------------------*- C++ -*----------------------------------*\ |
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.
Similarly: temporary backup file?
@@ -0,0 +1,19 @@ | |||
# Tutorial for an FSI simulation of an elastic flap perpendicular to a channel flow |
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 README probably needs to be updated to correspond to the interFoam case.
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 will work on this.
<!--<coupling-scheme:serial-explicit> | ||
<time-window-size value="1e-4"/> | ||
<max-time value="1.0"/> | ||
<participants first="Fluid" second="Calculix"/> | ||
<exchange data="Forces0" mesh="Solid" from="Fluid" to="Calculix"/> | ||
<exchange data="Displacements0" mesh="Solid" from="Calculix" to="Fluid"/> | ||
</coupling-scheme:serial-explicit>--> | ||
|
||
|
||
<!--<coupling-scheme:serial-implicit> | ||
<time-window-size value="1.e-3" /> | ||
<max-time value="0.5"/> | ||
<participants first="Fluid" second="Calculix"/> | ||
<exchange data="Forces0" mesh="Solid" from="Fluid" to="Calculix"/> | ||
<exchange data="Displacements0" mesh="Solid" from="Calculix" to="Fluid" /> | ||
|
||
<max-iterations value="100"/> | ||
<absolute-convergence-measure limit="1e-6" data="Displacements0" mesh="Solid"/> | ||
<relative-convergence-measure limit="1e-2" data="Forces0" mesh="Solid"/> | ||
<extrapolation-order value="2"/> | ||
|
||
<acceleration:IQN-ILS> | ||
<data name="Displacements0" mesh="Solid"/> | ||
<preconditioner type="residual-sum"/> | ||
<filter type="QR1" limit="1e-6"/> | ||
<initial-relaxation value="0.01"/> | ||
<max-used-iterations value="15"/> | ||
<time-windows-reused value="0"/> | ||
</acceleration:IQN-ILS> | ||
|
||
</coupling-scheme:serial-implicit>--> |
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 file needs some clean-up. We should choose a config that is robust but also uses default values wherever possible.
Thank you, @Alphaoo1! I additionally removed all the
I see that you are essentially taking the already produced mesh and rotating it. This is not an ideal solution, however, because:
I understand also that this is the easy solution and manually converting the blockMeshDict would be painful. I would then propose the following: let's keep the original blockMeshDict files and add the rotation commands in the run scripts. Then the user should be happy, even though a bit puzzled for the additional step. But this is then future problem. Before we start looking into details, let's also break this PR to smaller ones, one for each tutorial. With a quick look, I see changes/additions in the following directories:
In any case, please make your new PRs to target the |
Thank you for your patience @MakisH, I am a bit new to git workflow so not yet up to the standards.
No I am not rotating the already produced mesh.
As I said earlier, it's a bit more complicated to directly rotate mesh and have it aligned with Solid mesh.
Yes. Will do
The
Yes, I will create a new PR for the interFoam.
Ok. I will do the changes. |
Welcome to the git workflow! 🤗 I am always very happy to help anybody trying to learn, especially if it results in a contribution here. Pro tip: you are currently requesting to merge from your master branch. But now with all these changes I proposed you will mess up your current production work. So, better keep different "features" in different branches. For now, better make a branch for your work and keep this PR from master.
I had not heard about this tool before. Interesting but maybe not really needed. I will check again in a second round.
What do you mean "does not exactly match with Fluid mesh"? Unless there is an offset/rotation, this should not be an issue for preCICE. Ideally, we would like a rotated blockMeshDict and a rotated CalculiX configuration. This should be the cleanest solution and maybe not so difficult in this case, since the geometries are rather simple. I guess we should at least try to remove the Salome dependency and see what we can do afterwards. |
We forgot about this for a while, but it is also fine, as #146 now rotated the case as part of a larger restructuring project. |
A flap tutorial case for OpenFOAM-CalculiX, in the XY direction as needed in #34.
The meshes are created using Salome.
If some files are deleted during
./Allclean
, Readme.md contains instructions to recreate those files.preCICE version 2.0.2
OpenFOAM v7
CalculiX v2.15
Fixes #34.