CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

pimpleDyMFoam refine and moving mesh

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 2 Post By Tobi
  • 2 Post By guin
  • 1 Post By decibelle

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 5, 2017, 08:38
Default pimpleDyMFoam refine and moving mesh
  #1
Member
 
Join Date: May 2017
Posts: 38
Rep Power: 8
decibelle is on a distinguished road
hello,

I work with a moving mesh (oscillating and rotating mesh motion) with pimpledymfoam. I would like to refine this mesh during the running. is it possible with pimpledymfoam?
what I have to do?

thanks in advance
decibelle is offline   Reply With Quote

Old   July 11, 2017, 10:44
Default
  #2
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi,

short answer to a short question. Yes it is. There is the dynamicRefineFvMesh Lib (hope I wrote it correct). Here you can refine the mesh based on a quantity. It is called adaptive mesh refinement (AMR). One case can be checked out here: http://www.holzmann-cfd.de/index.php...aptive-meshing

However, the actual lib can only handle 3d cases properly. 2D case refinement is not possible and you only can refine hexaeders. All other volume types will be protected.
decibelle and LuisAndresMT like this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   July 11, 2017, 10:56
Default
  #3
Member
 
Join Date: May 2017
Posts: 38
Rep Power: 8
decibelle is on a distinguished road
thank you so much, it's just what I need
decibelle is offline   Reply With Quote

Old   July 12, 2017, 07:42
Default
  #4
Member
 
Rodrigo
Join Date: Mar 2010
Posts: 98
Rep Power: 16
guin is on a distinguished road
Quote:
Originally Posted by Tobi View Post
Hi,

short answer to a short question. Yes it is. There is the dynamicRefineFvMesh Lib (hope I wrote it correct). Here you can refine the mesh based on a quantity. It is called adaptive mesh refinement (AMR). One case can be checked out here: http://www.holzmann-cfd.de/index.php...aptive-meshing

However, the actual lib can only handle 3d cases properly. 2D case refinement is not possible and you only can refine hexaeders. All other volume types will be protected.
Just an observation:
From here one cannot deduce the compatibility of AMR with mesh motion in OpenFOAM. I think this was the initial question at this thread.

From my understanding, AMR uses "dynamicRefineFvMesh" and mesh motion uses "dynamicMotionSolverFvMesh". They are both "dynamicFvMesh"-based, but (I think that) their current implementation did not take into account their simultaneous use in a single case. In fact, both use the same dictionary (constant/dynamicFvMesh file), where you first must specify what kind of dynamicFvMesh utility do you want to use e.g. "staticFvMesh", "dynamicRefineFvMesh", "dynamicMotionSolverFvMesh", etc...

Please, correct me if I am wrong. Indeed I would be glad if anyone was able to use both functionalities within the same run and could share with the community the keypoints for that to work.
Tobi and xiaodingdang like this.
guin is offline   Reply With Quote

Old   July 12, 2017, 08:19
Default
  #5
Member
 
Join Date: May 2017
Posts: 38
Rep Power: 8
decibelle is on a distinguished road
Quote:
Originally Posted by guin View Post
Just an observation:
From here one cannot deduce the compatibility of AMR with mesh motion in OpenFOAM. I think this was the initial question at this thread.

From my understanding, AMR uses "dynamicRefineFvMesh" and mesh motion uses "dynamicMotionSolverFvMesh". They are both "dynamicFvMesh"-based, but (I think that) their current implementation did not take into account their simultaneous use in a single case. In fact, both use the same dictionary (constant/dynamicFvMesh file), where you first must specify what kind of dynamicFvMesh utility do you want to use e.g. "staticFvMesh", "dynamicRefineFvMesh", "dynamicMotionSolverFvMesh", etc...

Please, correct me if I am wrong. Indeed I would be glad if anyone was able to use both functionalities within the same run and could share with the community the keypoints for that to work.
Yes, you're right, it was my initial question. I try since 2 month to refine and to move the mesh, but actually I don't have any result.
NotOverUnderated likes this.
decibelle is offline   Reply With Quote

Old   July 12, 2017, 08:40
Default
  #6
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi all,

I am sorry that I did not get the real point of the question. To complete everything and proof what Guin already said:
  • You cannot do motion + refinement in FOAM with the standard utilities
  • You can make it possible - I did it already 2 years ago
  • Unfortunately, the command rm -r OpenFOAM2.4.x was too fast and I lost my development
  • As a guideline: You have to make a new library that first calls the lib which moves the mesh and then calls the lib which refines it
Based on the fact that I just tested it and lost my lib, I never did it again because there was no need (for my purpose). Sorry for that bad new. But if you will make such a library, I guess the community would be happy to have it

Again. Sorry for the miss understanding.



Good luck.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   December 5, 2017, 17:02
Default
  #7
New Member
 
Join Date: Apr 2013
Posts: 26
Rep Power: 13
pippo2013 is on a distinguished road
Hi Decibelle,

have you succeded in combining mesh moving and refining?
It would be a great help for me!
pippo2013 is offline   Reply With Quote

Old   October 27, 2023, 20:24
Default
  #8
New Member
 
Join Date: Jan 2018
Posts: 18
Rep Power: 8
Zhi Cheng is on a distinguished road
Hi, Tobi,

While I try to merge dynamicMotionFvMesh and dynamicRefineFvMesh into a single one, as guided by this link and also the YouTube video:
continuity error occurs when combining dynamicRefineFvMesh and dynamicMotionSolverFvM
https://www.youtube.com/watch?v=Yq-ySlXE5JQ
I successful compiled it but was faced with mesh unmatch during calculation:

No MRF models present

No finite volume options present
DICPCG: Solving for pcorr, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 0, global = 0, cumulative = 0
Constructing face velocity Uf

Courant Number mean: 0 max: 0

Starting time loop

Courant Number mean: 0 max: 0
Interface Courant Number mean: 0 max: 0
deltaT = 0.000119976
Time = 0.000119976

PIMPLE: iteration 1
Selected 176 cells for refinement out of 4624.
Refined from 4624 to 5856 cells.
Selected 0 split points out of a possible 176.


--> FOAM FATAL ERROR:
Size of newPoints 9522 does not correspond to current mesh points size 11643

From function virtual Foam::tmp<Foam::Field<double> > Foam:olyMesh::movePoints(const pointField&)
in file meshes/polyMesh/polyMesh.C at line 1120.

FOAM exiting



I think this happened because the mesh is refined and topo is changed while the motion solver is about to run, 'newpoints' here refers to the original mesh inside polyMesh file. I tried to code something before motion solver's running but failed. Do you have any suggestions on this?
Thanks!
Zhi

Quote:
Originally Posted by Tobi View Post
Hi all,

I am sorry that I did not get the real point of the question. To complete everything and proof what Guin already said:
  • You cannot do motion + refinement in FOAM with the standard utilities
  • You can make it possible - I did it already 2 years ago
  • Unfortunately, the command rm -r OpenFOAM2.4.x was too fast and I lost my development
  • As a guideline: You have to make a new library that first calls the lib which moves the mesh and then calls the lib which refines it
Based on the fact that I just tested it and lost my lib, I never did it again because there was no need (for my purpose). Sorry for that bad new. But if you will make such a library, I guess the community would be happy to have it

Again. Sorry for the miss understanding.



Good luck.
Zhi Cheng is offline   Reply With Quote

Old   October 28, 2023, 02:30
Default
  #9
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi,

Well potential some ideas but no time to check them.
However, I was expecting that there is one dynamic library which allows one to call several dynamic libs without coding.

Not sure if this was in the cfd.direct or openCFD version.
In addition, I am not sure how old the documentation is to which you refer.

OpenFoam changes quite a lot over the released. openCFD tries to keep compatibility but cfd.direct not really. Not sure which one is better. Don't like backwards compatibility for a long time.

So long story short.
No idea up to now.
I would need to check the sources and how things work.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   October 28, 2023, 04:26
Default
  #10
New Member
 
Join Date: Jan 2018
Posts: 18
Rep Power: 8
Zhi Cheng is on a distinguished road
Hi, Tobi,

Many thanks for your reply! I could quickly shows you what I modified based on the original 'dynamicRefineFvMesh'. The full file for updated 'dynamicRefineFvMesh' is also attached for your information.
I just add the following codes inside 'bool Foam::dynamicRefineFvMesh::update()' after refining mesh is done every cycle:

fvMesh::movePoints(motionPtr_->newPoints());

volVectorField* Uptr = getObjectPtr<volVectorField>("U");

if (Uptr)
{
Uptr->correctBoundaryConditions();
}


I know the error I mentioned before occurs just the following command is running:
fvMesh::movePoints(motionPtr_->newPoints());

It seems I need to add something before this line codes to use the refined mesh to update current mesh, but I don't I which command I should add. I tried several possible options but all failed.

It is worth mentioning that when I add the above motion solver command before the mesh refinement command, the first time step can run normally, and the second time step provides a similar error report, that is, the grid was already updated at the start of the second time step, resulting in a mismatch. The error command is as follows:

Interface Courant Number mean: 0 max: 0
deltaT = 0.000119976
Time = 0.000119976

PIMPLE: iteration 1
DICPCG: Solving for cellDisplacementx, Initial residual = 0, Final residual = 0, No Iterations 0
DICPCG: Solving for cellDisplacementy, Initial residual = 0, Final residual = 0, No Iterations 0
Selected 176 cells for refinement out of 4624.
Refined from 4624 to 5856 cells.
Selected 0 split points out of a possible 176.
DICPCG: Solving for pcorr, Initial residual = 2.26625e-11, Final residual = 2.26625e-11, No Iterations 0
time step continuity errors : sum local = 8.55969e-33, global = 0, cumulative = 0
diagonal: Solving for alpha.air, Initial residual = 0, Final residual = 0, No Iterations 0
smoothSolver: Solving for alpha.other, Initial residual = 5.01386e-07, Final residual = 5.01386e-07, No Iterations 0
Air phase volume fraction = 0.638889 Min(alpha.air) = 0 Max(alpha.air) = 1
Liquid phase volume fraction = 0.0277778 Min(alpha.other) = 0 Max(alpha.other) = 1
diagonal: Solving for alpha.air, Initial residual = 0, Final residual = 0, No Iterations 0
smoothSolver: Solving for alpha.other, Initial residual = 5.01386e-07, Final residual = 5.01386e-07, No Iterations 0
Air phase volume fraction = 0.638889 Min(alpha.air) = 0 Max(alpha.air) = 1
Liquid phase volume fraction = 0.0277778 Min(alpha.other) = 0 Max(alpha.other) = 1
DICPCG: Solving for p_rgh, Initial residual = 1, Final residual = 0.033215, No Iterations 2
time step continuity errors : sum local = 0.000327455, global = 1.6465e-19, cumulative = 1.6465e-19
DICPCG: Solving for p_rgh, Initial residual = 0.0210765, Final residual = 0.00104551, No Iterations 19
time step continuity errors : sum local = 2.1042e-05, global = -2.14697e-21, cumulative = 1.62503e-19
DICPCG: Solving for p_rgh, Initial residual = 0.00787536, Final residual = 9.15592e-08, No Iterations 129
time step continuity errors : sum local = 1.85098e-09, global = -3.61728e-23, cumulative = 1.62467e-19
time step continuity errors : sum local = 1.85098e-09, global = -3.61728e-23, cumulative = 1.62431e-19
ExecutionTime = 0.27 s ClockTime = 0 s

Courant Number mean: 1.03498e-05 max: 0.00211289
Interface Courant Number mean: 0 max: 0
deltaT = 0.000144006
Time = 0.000263982

PIMPLE: iteration 1


--> FOAM FATAL ERROR:
given patch field does not correspond to the meshPoints. Field size: 544 meshPoints size: 562

From function void Foam:ointPatchField<Type>::setInInternalField(Fo am::Field<Type2>&, const Foam::Field<Type2>&, const labelList&) const [with Type1 = Foam::Vector<double>; Type = Foam::Vector<double>; Foam::labelList = Foam::List<int>]
in file /opt/OpenFOAM/OpenFOAM-v1912/src/OpenFOAM/lnInclude/pointPatchField.C at line 267.

FOAM aborting


Best,
Zhi

Quote:
Originally Posted by Tobi View Post
Hi,

Well potential some ideas but no time to check them.
However, I was expecting that there is one dynamic library which allows one to call several dynamic libs without coding.

Not sure if this was in the cfd.direct or openCFD version.
In addition, I am not sure how old the documentation is to which you refer.

OpenFoam changes quite a lot over the released. openCFD tries to keep compatibility but cfd.direct not really. Not sure which one is better. Don't like backwards compatibility for a long time.

So long story short.
No idea up to now.
I would need to check the sources and how things work.
Attached Files
File Type: zip dynamicRefineFvMesh.zip (33.9 KB, 6 views)
Zhi Cheng is offline   Reply With Quote

Old   January 4, 2024, 22:13
Default Facing the same cell count mismatch error!
  #11
New Member
 
Shridhar
Join Date: May 2021
Posts: 6
Rep Power: 4
Kazeshini8999 is on a distinguished road
Hey Zhi,

Were you able to get your code to work, and if so what changes did you implement. Thanks in advance!
Kazeshini8999 is offline   Reply With Quote

Reply

Tags
movingmesh, pimpledymfoam, refine mesh


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] SnappyHexMesh for internal Flow vishwa OpenFOAM Meshing & Mesh Conversion 24 June 27, 2016 08:54
[snappyHexMesh] No layers in a small gap bobburnquist OpenFOAM Meshing & Mesh Conversion 6 August 26, 2015 09:38
Overset: refine background mesh without resetting the mesh JohnAB STAR-CCM+ 6 May 19, 2014 13:48
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! sc298 OpenFOAM Meshing & Mesh Conversion 2 March 27, 2011 21:11
[snappyHexMesh] external flow with snappyHexMesh chelvistero OpenFOAM Meshing & Mesh Conversion 11 January 15, 2010 19:43


All times are GMT -4. The time now is 15:28.