|
[Sponsors] |
![]() |
![]() |
#41 |
New Member
Luca Cornolti
Join Date: Jun 2016
Location: Switzerland
Posts: 13
Rep Power: 10 ![]() |
In the 3D case the original hex cell is cut into 8 smaller ones, new faces, edges and points are created.
One problem is how to link all these new features together and how to keep a track of them in order to remove all of them during the unrefinement step. The second one is how to use these information. In 3D, for every cut cell a new point is created in its centre. This point is shared by the 8 daughter cells. The original 3D code employs a list of these points to get all the information related the features created during the cutting process in a cascade process. In short: 1) this central point is shared by 6 central edges, 2) the point of the other side of these edges is in the centre of the cut faces and is shared by 3) the four created faces for each original face. 4) The vertexes of these faces are the corners of the original cell and the points in the middle of the original edges. To reproduce this cascade process in 2D and reuse most of the functions of the original code, the main trick of my code was to replace this list of points with a list of central edges, as in 2D we cut the cell into four smaller cells which shares an edge in the centre. Then, by simply skipping the first step of the 3D cascade process, we get all the information needed in the same way. In 1D you have fewer new features. Following the same logic, you could use a list of central faces which is formed by the four created points in the middle of the original edges. This is just a way to link information, then you have to change all the functions which uses them. For example in 1D you cut 2 of the original faces into 2 and the new face are formed by 2 original corners and 2 created points in the middle of the original edges, while in 2D and 3D the new faces have 1 original corner and 3 created points. In other words there is some work to do… I saw that the main developers of foam-extend very recently worked on this topic too. From What I saw they developed a new class which is able to handle both 2D and 3D cases, but not 1D. |
|
![]() |
![]() |
![]() |
![]() |
#42 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,712
Blog Entries: 6
Rep Power: 52 ![]() ![]() ![]() |
Hi all,
interesting developments. I also build a 2D mesh refinement library but within a completely different manner. However, may I suggest you something:
__________________
Keep foaming, Tobias Holzmann |
|
![]() |
![]() |
![]() |
![]() |
#43 | |
New Member
BOLUN YANG
Join Date: Oct 2018
Posts: 3
Rep Power: 8 ![]() |
Quote:
I have the same problem with you, did you finally solve it? Best Yang |
||
![]() |
![]() |
![]() |
![]() |
#44 |
New Member
Daniele
Join Date: Oct 2018
Posts: 3
Rep Power: 8 ![]() |
Hi everyone,
when running blockMesh with Luca´s 2D amr code in openfoam6 I get some warnings, mostly related to issues in loading the "libdynamicFvMeshUser.so". The code works anyway when running a case on a sigle processor. If I run in parallel instead, it fails to reconstrucPar afterwards. Has anyone had the same issue? And is that the case for the code in openfoam4 too? I attach the log files for blockMesh, decomposePar and reconstructPar with the warnings I get. Thanks in advance |
|
![]() |
![]() |
![]() |
![]() |
#45 | |
New Member
Luca Cornolti
Join Date: Jun 2016
Location: Switzerland
Posts: 13
Rep Power: 10 ![]() |
Quote:
Reconstruction after parallel run with dynamic mesh refinement To solve your issue just use these commands in sequence: "reconstructParMesh" to reconstruct just the mesh and then "reconstructPar" to reconstruct the fields. |
||
![]() |
![]() |
![]() |
![]() |
#46 |
New Member
Daniele
Join Date: Oct 2018
Posts: 3
Rep Power: 8 ![]() |
Thanks for the feedback Luca.
One more question, if I may. When running the AMR utility I notice that a mesh originally made by only hexahedra will turn into one with polyhedra. The same happens also when using the standard refineMesh utility of the OpenFOAM distribution. Do you have any hint on this? Thanks in advance, Daniele |
|
![]() |
![]() |
![]() |
![]() |
#47 |
Member
Join Date: May 2016
Posts: 39
Rep Power: 10 ![]() |
Hi Luca!
The code you provided compiles nicely for of6 version, but gives the following issues for ofv1806. Any idea how how to fix this? dynamicRefineFvMesh2D/dynamicRefineFvMesh2D.C: In member function ‘virtual bool Foam::dynamicRefineFvMesh2D::writeObject(Foam::IOs treamOption::streamFormat, Foam::IOstreamOption::versionNumber, Foam::IOstreamOption::compressionType, bool) const’: dynamicRefineFvMesh2D/dynamicRefineFvMesh2D.C:1474:32: error: no matching function for call to ‘Foam::hexRef2D::write(const bool&) const’ && meshCutter_.write(valid) ^ In file included from dynamicRefineFvMesh2D/dynamicRefineFvMesh2D.H:83:0, from dynamicRefineFvMesh2D/dynamicRefineFvMesh2D.C:26: /home/user/OpenFOAM/OpenFOAM-v1806/src/dynamicMesh/lnInclude/hexRef2D.H:585:18: note: candidate: bool Foam::hexRef2D::write() const bool write() const; ^~~~~ /home/user/OpenFOAM/OpenFOAM-v1806/src/dynamicMesh/lnInclude/hexRef2D.H:585:18: note: candidate expects 0 arguments, 1 provided /home/user/OpenFOAM/OpenFOAM-v1806/wmake/rules/General/transform:34: recipe for target 'Make/linux64Gcc63DPInt32Opt/dynamicRefineFvMesh2D/dynamicRefineFvMesh2D.o' failed make: *** [Make/linux64Gcc63DPInt32Opt/dynamicRefineFvMesh2D/dynamicRefineFvMesh2D.o] Error 1 Cheers. |
|
![]() |
![]() |
![]() |
![]() |
#48 | |
New Member
Luca Cornolti
Join Date: Jun 2016
Location: Switzerland
Posts: 13
Rep Power: 10 ![]() |
Quote:
I just downloaded the code and it still compiles well. I suppose that you are not the first guy who downloaded it, but you are the first one who encountered this issue. Are you sure than you are using the plain v1806 version and not, for example, the plus version? Maybe the developers changed something in the basic code which clashes with the library. |
||
![]() |
![]() |
![]() |
![]() |
#49 | |
Member
Join Date: May 2016
Posts: 39
Rep Power: 10 ![]() |
Quote:
Hi Luca, the v1806 (have not tested the others) has issues with parallel run. Works up to 4 processors, anything above this numbers it just holds still at first refinement and doesn't proceed. I'm guessing its communication issue. Do you have any idea how to fix this in the code? Cheers |
||
![]() |
![]() |
![]() |
![]() |
#50 |
New Member
Ajit Kumar
Join Date: Aug 2013
Location: Shiv Nadar University, India
Posts: 6
Rep Power: 13 ![]() |
Sharing my github repo, which builds upon Luca Cornolti's foam-extend code. Compilation instructions and a demo example is included as well.
https://github.com/krajit/dynamicRefine2DFvMesh Thanks to Luca, Shonibare, and Ahmad for working in this area. Feedbacks are most welcome. Ajit Kumar, Assistant Professor, Mathematics, Shiv Nadar University, India |
|
![]() |
![]() |
![]() |
![]() |
#51 | |
Member
Join Date: May 2016
Posts: 39
Rep Power: 10 ![]() |
Quote:
thanks for sharing the library. The tutorial works fine for me. Just to let you know that the lib doesn't work a more complex wedge geometry (while the one from Lucas does). Lucas code works with no error, with yours the output I get at the first refinement is: --> FOAM FATAL ERROR: cell 3248 of level 0 does not seem to have 8 points of equal or lower level cellPoints:8(47082 47083 47084 47085 5020 5021 5022 5023) pointLevels:8{0} Cheers, |
||
![]() |
![]() |
![]() |
![]() |
#52 |
New Member
Ajit Kumar
Join Date: Aug 2013
Location: Shiv Nadar University, India
Posts: 6
Rep Power: 13 ![]() |
Hi,
Thanks for trying it out. Admittedly, I did not attempt any wedge geometry. Best, Aijt |
|
![]() |
![]() |
![]() |
![]() |
#53 |
New Member
Karthik Thyagarjan
Join Date: Jul 2019
Posts: 4
Rep Power: 7 ![]() |
Hey, with reference to the of6 code by Luca , I was able to build my own code. but one thing i notice with newer versions of openfoam is that the sometime the split cells end up as tetrahedrons or prisms instead of remaining a cube or in case of 2D a square
I am new to the AMR, so if you have any leads on how to conserve the square it would be a great help. |
|
![]() |
![]() |
![]() |
![]() |
#54 |
New Member
Mark
Join Date: Oct 2018
Posts: 18
Rep Power: 8 ![]() |
Dear all,
Thank you for sharing these codes. I managed to compile Luca's meshRefinement2D_of6.tar.gz file on OF6 and the attached dambreak cases run all good (indeed meshing dynamically). I am trying to employ the dynamic mesh refinement for reacting flow system - i am currently attempting this on a simple reactingFoam OF tutorial: /opt/openfoam6/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D So what I do is: I copy the dynamicMeshDict file into the constant folder and change the field of refinement from alpha.water to T and add the libs ("libdynamicFvMeshUser.so") to the controlDict file. I run the case normally: blockmesh + reactingFoam but no mesh is getting refined (although the case itself runs fine). Am I missing something? Could somebody please tell me how you managed to do this for a non-DamBreak case. Thank you! |
|
![]() |
![]() |
![]() |
![]() |
#55 |
New Member
Mark
Join Date: Oct 2018
Posts: 18
Rep Power: 8 ![]() |
Hi Luca!
Thank you for sharing these codes. I managed to compile the meshRefinement2D_of6.tar.gz file on OF6 and the attached dambreak cases run all good (indeed meshing dynamically). I am trying to employ the dynamic mesh refinement for reacting flow system - i am currently attempting this on a simple reactingFoam OF tutorial: /opt/openfoam6/tutorials/combustion/reactingFoam/laminar/counterFlowFlame2D So what I do is: I copy the dynamicMeshDict file into the constant folder and change the field of refinement from alpha.water to T and add the libs ("libdynamicFvMeshUser.so") to the controlDict file. I run the case normally: blockmesh + reactingFoam but no mesh is getting refined (although the case itself runs fine). Am I missing something? Could somebody please tell me how you managed to do this for a non-DamBreak case. Thank you! |
|
![]() |
![]() |
![]() |
![]() |
#56 |
New Member
Luca Cornolti
Join Date: Jun 2016
Location: Switzerland
Posts: 13
Rep Power: 10 ![]() |
Dear Mark,
not all OpenFOAM solvers support dynamic mesh refinement. In particular, I'm quite sure that reactingFoam does not. You can check it by comparing the output of reactingFoam with the one of a solver which supports it like interFoam and see if there are the same references to the dynamic mesh refinement library (for example you should find the sentence "Selecting dynamicFvMesh ..."). Alternatively, you should check the source code of the solver (nameOfTheSolver.C) and see if the header of the dynamic mesh class "dynamicFvMesh.H" is included or not. If not, you have to create your own solver. This is actually quite simple, just compare the source code of two solvers: one which supports it and one which does not. Identify the lines connected to dynamicFvMesh class and add them into your solver. Eventually, I suggest you to look at the OpenFOAM-5 realease, because that was the last release where there were two versions of the same solver, one which supports dynamic mesh refinement (labelled with ad additional DyM in the name of the solver) and one which does not. For example, you can compare interFoam and interDyMFoam. |
|
![]() |
![]() |
![]() |
![]() |
#57 |
Member
Join Date: May 2016
Posts: 39
Rep Power: 10 ![]() |
Hi,
there is a bug in the dynamicRefineFvMesh2D library (compiled with OFv1812 - I have not tested the others). More specifically while running compressibleInterFoam and refining the interface, there is nonphysical entrapment of lighter phase in the heavier one when refining. EDIT: This issue ALSO appears with dynmicRefineFvMesh (the second picture without trapped phase, gets trapped phase, but a bit later in simulation.) To show this I attached a case (two pictures) of high speed water jet in axis-symmetrical wedge configuration (in 3D this does not happen). Only difference between the simulations are refinement libraries.This issue does not occur with the non-dynamic mesh. Any ideas on how to fix this issue? |
|
![]() |
![]() |
![]() |
![]() |
#58 | |
New Member
Luca Cornolti
Join Date: Jun 2016
Location: Switzerland
Posts: 13
Rep Power: 10 ![]() |
Quote:
I think that this issue is related to the mapping algorithm more than the dynamicRefineFvMesh class which only deals with the change of the mesh. If you found this issue also with the standard dynamicRefineFvMesh class, you can report this to the official developer as described here: https://www.openfoam.com/code/bug-reporting.php. You could also check if this issue still occurs with version v1906. |
||
![]() |
![]() |
![]() |
![]() |
#59 | |
Member
Join Date: May 2016
Posts: 39
Rep Power: 10 ![]() |
Quote:
https://www.openfoam.com/releases/op...2/numerics.php Does the port to v1812 include this new algorithm? EDIT: it does not. Last edited by dzordz; August 28, 2019 at 05:59. |
||
![]() |
![]() |
![]() |
![]() |
#60 |
Member
Join Date: May 2016
Posts: 39
Rep Power: 10 ![]() |
I have been testing the new mapping algorithm in v1812 (in 3D refinement since 2D is unavailable) and it performs much better and eliminates this issue of air bubbles being trapped. However when looking into the source code I see that the code from Ajit is based on v1806 and does not include the new mapping. Basically it is modified Lucas code made so that it can compile on v1812. Therefore it should not state that is v1812.
Is anybody working on actually having v1812 in 2D with the new mapping algorithm? |
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[snappyHexMesh] SnappyHexMesh for internal Flow | vishwa | OpenFOAM Meshing & Mesh Conversion | 24 | June 27, 2016 09:54 |
[Workbench] mesh refinement of vortex tube using workbench | aqsa1590 | ANSYS Meshing & Geometry | 3 | December 25, 2014 09:57 |
[snappyHexMesh] snapEdge - failure | Tobi | OpenFOAM Meshing & Mesh Conversion | 33 | March 18, 2014 04:58 |
Mesh motion with Translation & Rotation | Doginal | CFX | 2 | January 12, 2014 07:21 |
Icemcfd 11: Loss of mesh from surface mesh option? | Joe | CFX | 2 | March 26, 2007 19:10 |