|
[Sponsors] |
May 26, 2014, 15:04 |
Combining mesh motion and refinement
|
#1 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
Hello everyone,
I am currently working on on a mesh class the combines dynamicRefineFvMesh and dynamicMotionSolverFvMesh. A bit of history to bring you up to speed. Back in 2.1.x, it was easy enough; I copied the motion calls and velocity boundary correction from dynamicMotionSolverFvMesh and put them in the update() function which also has the refinement from dynamicRefineFVMesh. This worked masterfully on a case based on aachenBomb with a moving boundary and refinement on the C7H16 field. In 2.2.x, I tried using this mesh for a case with some non-hexahedral cells, and the refinement failed on these cells. They weren't being added to the protectedCells list as they should have. This was fixed with the following commit: https://github.com/OpenFOAM/OpenFOAM...f842e027a0694e I've been trying in both 2.2.x and 2.3.x to get them combining, but can't seem to get meshPhi to be properly updated at refinement. This causes a problem as meshPhi is required for updating the velocity boundary conditions after mesh motion. I posted a bug report here: http://www.openfoam.org/mantisbt/view.php?id=1195, which solved another issue but hasn't quite allowed me to do what I want. Does anyone know how I can get these two mechanisms to "play nice"? Many thanks to you all! |
|
May 26, 2014, 18:27 |
|
#2 | ||
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Marco,
Although you did give a good summary of the changes you've made and tried, it feels a bit like flying blind here, as there is no clear indication of where you tried to change what exactly. I did however find this piece of lost code in OpenFOAM 2.3.x, in the file "src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C", a bit lost in the methods "refine": Quote:
Code:
newPoints = motionPtr_->newPoints() Code:
// Change mesh and generate map. //autoPtr<mapPolyMesh> map = meshMod.changeMesh(*this, true); You could try: Code:
meshMod.movePoints(newPoints); Quote:
Either way, from the small experience I have with mesh manipulation (mostly from creating a variant of stitchMesh, named stitchMeshMultiPatch), it seems to be better to perform all mesh manipulations by a single operator (in my case, using a single instance of "polyTopoChanger"), rather then using 2 consecutive operators. Best regards, Bruno
__________________
|
|||
May 26, 2014, 18:55 |
|
#3 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
Thanks for the reply Bruno. What I had done back in 2.1.x was add the call for
Code:
dynamicFvMesh::movePoints(motionPtr->newPoints()) I've put up a new bug report, which may or may not help better understand: http://www.openfoam.org/mantisbt/view.php?id=1305 If I turn off correctPhi in system/fvSolution and use fixedValue boundary condition on the moving wall the case runs, though the velocity near the wall is wrong unless I explicitly setting it as the value. This works for the very simple case I made for the bug report, but may not be for engine cases or similar. At any rate, its only the call to meshPhi that crashes things, which makes it feel like it dissapears during the refinement. I will try moving the mesh movement to where you mentioned and see what happens. Expect a report! EDIT: Tried moving the mesh motion to commented out code and the same result was obtained. |
|
May 27, 2014, 18:31 |
|
#4 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Quote:
It essentially does point motion, re-meshing and motion optimization with Mesquite... or at least it's my interpretation of it. It only works with tetrahedral cells, but the way it handles the mesh manipulation is different from how OpenFOAM does it, which is why I do think this might come in handy for you. I say this because re-meshing is conceptually similar to mesh refinement and this library also handles motion driven by outside forces. My memory is very fuzzy from when I looked into it last year, so I don't remember much about what I learned from that source code. Nonetheless, a few memory breadcrumbs are registered on this thread: http://www.cfd-online.com/Forums/ope...opofvmesh.html - On that thread, the initial case discussed (which had some issues running) was a ball floating inside a tube. |
||
June 6, 2014, 16:37 |
|
#5 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Marco,
I remembered to come back to this issue to leave a comment for other forum readers. The fix was eerily simple and it didn't needed any change in "dynamicRefineFvMesh": Quote:
Bruno |
||
June 6, 2014, 17:10 |
|
#6 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
Thanks Bruno, I was relieved to see the fix go though and pulled that commit faster than you can say Courant Number.
|
|
April 19, 2018, 04:29 |
|
#7 |
New Member
Join Date: Dec 2015
Posts: 16
Rep Power: 11 |
Hi Marco,
do you succeeded in generating a new class which combines dynamicRefineFvMesh and dynamicMotionSolverFvMesh? I'm eager to hear your update. Best wishes Q.E.D. |
|
April 20, 2018, 14:56 |
|
#8 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
I was able to get it to work. The fix above was the answer, and I think I also had to do the move after the refinement.
|
|
April 20, 2018, 15:12 |
|
#9 |
New Member
Join Date: Dec 2015
Posts: 16
Rep Power: 11 |
Great news! I wonder whether you would mind to share your library? I'm currently working on a case where it might prove very useful!
Anyway, I think the community would be glad to see this library in the next release! Best Wishes QED |
|
April 20, 2018, 15:19 |
|
#10 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
Unfortunately I can't as it was developed for work with some other functionality. But the basics are reasonably straightforward. Just clone dynamicFvRefinementMesh into a new mesh class and add the motion solver creation in the constructor and the mesh motion calls from dynamicFvMotionSolverMesh in the update() member function.
You will also need to include all the necessary libraries and source files for it to compile. Depending on which version of OF you have and how your pEqn.H file looks, moving the mesh may need to happen before or after refinement. Only testing will tell you for sure. Good luck! |
|
April 20, 2018, 16:47 |
|
#11 |
New Member
Join Date: Dec 2015
Posts: 16
Rep Power: 11 |
Ah, I suspected something Like this. Thank you nonetheless Marco for your valueable tips! I will try to implement it myself! I just thought that maybe I don't have to reinvent the wheel. (As we say here in Germany) :-)
Have a nice weekend! |
|
April 25, 2018, 09:45 |
|
#12 | |
New Member
Join Date: Dec 2015
Posts: 16
Rep Power: 11 |
Hi Marco,
I did as you suggested and the new class compiles well. But I encounter an error which says: Quote:
Do you have another tip for me? Best wishes Q.E.D. |
||
April 29, 2018, 05:58 |
|
#13 |
New Member
Join Date: Dec 2015
Posts: 16
Rep Power: 11 |
Hey everyone,
just a small update: I managed to solve the problem. But I used a chalmers report as a basis, where a new class is derived from dynamicRefineFvMesh and a solidBodyMotionFunction is added as the motion solver. With some minor changes the class works well in OpenFOAM-5.x. The change in the movingWallVelocity BC is not necessary anymore. In the attachment you will find the library and a test case. The test case is Tobis interfaceAndColumnRefine (www.holzmann-cfd.de) which I modified slightly. Thats because I tried to replace the standard dynamicRefineFvMesh by Tobis dynamicInterfaceRefineFvMesh (Since I was interested in the motion and refinement of an InterDyMFoam-Case), but some error occured which I could not resolve due to my lack of C++ skills. Best wishes, Q.E.D. |
|
April 29, 2018, 17:31 |
|
#14 |
New Member
Join Date: Dec 2015
Posts: 16
Rep Power: 11 |
With some small adjustments in Make/options you are able to include Tobis interface refinement library with the motion solver. Have a look at the attached files.
|
|
May 4, 2018, 06:22 |
|
#15 |
New Member
Join Date: Dec 2015
Posts: 16
Rep Power: 11 |
Ok, something is still wrong with this library. I was able to stabilize the computation only by setting the frequency of the movement to zero. (Which is equal to no movement obviously)
Now I have no clue at all.... |
|
September 16, 2022, 02:04 |
|
#16 |
New Member
ABG
Join Date: Sep 2021
Posts: 1
Rep Power: 0 |
Hello I have created a video about the procedure of merging two libraries dynamicMotionFvMesh and dynamicRefineFvMesh. Hope it helps all existing and future users.
https://youtu.be/Yq-ySlXE5JQ |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[snappyHexMesh] snappyHexMesh Boundary Layer at Corner | panpanzhong | OpenFOAM Meshing & Mesh Conversion | 5 | July 3, 2018 06:53 |
Automatic Mesh Refinement in OpnFOAM-1.6-ext | Daniel_Khazaei | OpenFOAM Running, Solving & CFD | 0 | October 4, 2013 18:48 |
Mesh Motion and Refinement in 2.1.x | mturcios777 | OpenFOAM Programming & Development | 16 | July 3, 2013 00:03 |
map point Fields in dynamicRefineFvMesh | lukasfischer | OpenFOAM Running, Solving & CFD | 9 | October 26, 2012 11:06 |
Mesh Motion + Refinement | Oli | OpenFOAM Running, Solving & CFD | 0 | July 12, 2010 21:35 |