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

Restart a dynamic refined simulation from a different time-step

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 27, 2017, 12:08
Default Restart a dynamic refined simulation from a different time-step
  #1
Senior Member
 
Andrea Ferrari
Join Date: Dec 2010
Posts: 319
Rep Power: 17
Andrea_85 is on a distinguished road
Hi All,

Is there a way to restart a simulation with dynamic mesh refinement (interDyMFoam) from a time different from zero, and prevent openFoam from refining again a mesh that has already been refined in the previous steps?

If a simply restart the simulation from a time different from the 0-time, openfoam takes the already refined mesh as the "base" mesh and refines again. i would like to avoid this. I though about using mapField utility to map the "refined" fields at a certain time back on the base mesh (not refined) and restart the simulation from there but i was wondering if there is a quicker way to do that.

best,
Andrea
Andrea_85 is offline   Reply With Quote

Old   June 27, 2017, 12:35
Default
  #2
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 21
floquation will become famous soon enough
I can, from the top of my head, come up with two tactics. Not sure whether they will work:

  1. Copy the refined mesh from the time directory to the constant directory (so overwriting the original mesh) and continue the simulation using interFoam (which does not do DyM refining). You might want to clone the case before overwriting the original mesh though.
  2. Change the refinement criterion in "constant/dynamicMeshDict":
    • change maxCells to a low value, such that it will no longer add new cells.
    • change the refinement criterion to a value such that all cells should be refined. In that manner it does not remove the refinement from cells either.
floquation is offline   Reply With Quote

Old   June 27, 2017, 13:02
Default
  #3
Senior Member
 
Andrea Ferrari
Join Date: Dec 2010
Posts: 319
Rep Power: 17
Andrea_85 is on a distinguished road
Kevin,

thanks for you answer. However what i want is to keep using the dynamic mesh refinement and this will not be case with your 2 criteria. The mesh would remain static and equal to the mesh of the last saved time-step. I would like openfoam to "mark" the mesh as "already refined" in the first time-step and then continue the simulation by adding and removing cells with the same criteria used before. not sure if it is possible...

andrea
Andrea_85 is offline   Reply With Quote

Old   June 28, 2017, 07:17
Default
  #4
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 21
floquation will become famous soon enough
So you want to freeze the refinement level, such that cells that were already refined to level 2 are reset to level 0, such that they can again be refined to level 2 (which corresponds to level 4 relative to your initial mesh)?

I don't know how to do that / whether it is possible at all, but you could try to open the refinementLevel file in your time directory and nullify all values.
floquation is offline   Reply With Quote

Old   June 30, 2017, 12:16
Default
  #5
Senior Member
 
Andrea Ferrari
Join Date: Dec 2010
Posts: 319
Rep Power: 17
Andrea_85 is on a distinguished road
I do not want to freeze the refinement level, i just want openfoam to identify already refined cells from not-refined cells when i restart a simulation and i ve just realized that this is specified in "cellLevel" file. My maximum level of refinement is 2, which means that if the cellLevel for a specific cell is 2, OF must not refine. However when i restarted the simulation from the last saved time it looks like OF does not read the refinement level and refines again cells that have been already refined before, giving a global maximum refinement level of 4 instead of 2.

Anyway, after playing a bit i solved the problem.

If i don't reconstruct the mesh of the last saved time of the first simulation and i simply restart from latestTime everything runs just fine. OF correctly identifies already refined cells from not-refined.

However if i reconstruct the last saved time using

Code:
reconstructParMesh -latestTime -mergeTol 1e-6
reconstructPar -latestTime
then i decompose again the latestTime and restart the simulation from there, OF does not recognize anymore cells already refined from not-refined and refines again up to level 4.
I do not know why this is happening but it might be related to this line i got in the log file:

Code:
Detected 122168 cells that are protected from refinement. Writing these to cellSet protectedCells.
i do not get this line if i don't reconstruct the mesh.

Best,

Andrea
Andrea_85 is offline   Reply With Quote

Old   December 21, 2017, 21:40
Default
  #6
New Member
 
Oliver Pasqual
Join Date: Nov 2016
Posts: 5
Rep Power: 10
MPJntu is on a distinguished road
Quote:
Originally Posted by Andrea_85 View Post
I do not want to freeze the refinement level, i just want openfoam to identify already refined cells from not-refined cells when i restart a simulation and i ve just realized that this is specified in "cellLevel" file. My maximum level of refinement is 2, which means that if the cellLevel for a specific cell is 2, OF must not refine. However when i restarted the simulation from the last saved time it looks like OF does not read the refinement level and refines again cells that have been already refined before, giving a global maximum refinement level of 4 instead of 2.

Anyway, after playing a bit i solved the problem.

If i don't reconstruct the mesh of the last saved time of the first simulation and i simply restart from latestTime everything runs just fine. OF correctly identifies already refined cells from not-refined.

However if i reconstruct the last saved time using

Code:
reconstructParMesh -latestTime -mergeTol 1e-6
reconstructPar -latestTime
then i decompose again the latestTime and restart the simulation from there, OF does not recognize anymore cells already refined from not-refined and refines again up to level 4.
I do not know why this is happening but it might be related to this line i got in the log file:

Code:
Detected 122168 cells that are protected from refinement. Writing these to cellSet protectedCells.
i do not get this line if i don't reconstruct the mesh.

Best,

Andrea

Dear Andrea,

I got the same problem as you. It seems that the OF does not change the mesh after decoposing the mesh reconstructed. So, do you have any progress in this?

Thanks.
O.P
MPJntu is offline   Reply With Quote

Old   November 29, 2018, 09:28
Default
  #7
Member
 
Join Date: May 2016
Posts: 39
Rep Power: 10
dzordz is on a distinguished road
Hi Andrea_85,

option that you talk about is possible to achieve and I use it to redistribute the cells more evenly during the simulation. I have a highly transient simulation that eventually comes to steady state, so the number of cells changes drastically during the simulation. I actually stop the code few times to redistribute the cells and run in forward (can be done with simple bash code).

What you already figured out is that which cells are refined is written in cellLevel file. So what you need to do is to make sure that after you reconstruct the mesh this files are in your times steps in polymesh folder. By running in sequence reconstructParMesh and then raconstructPar (makes your cellLevel & pointLevel files) you should be able to get this. I usually copy the last time step, constant and system folders in a new subfolder, then I remove polyMesh from constant and replace it with the new polyMesh from the last time step. Only thing left is decomposition via: decomposePar -constant and running the case again.

Most importantly, for me this works with version OF41 but not with OF301. So do some testing with your versions.

Hope this helps,
Cheers
dzordz is offline   Reply With Quote

Reply


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
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field lakeat OpenFOAM Community Contributions 58 December 23, 2021 03:36
p_rgh initial residual no change with different settings manuc OpenFOAM Running, Solving & CFD 3 June 26, 2018 16:53
Star cd es-ice solver error ernarasimman STAR-CD 2 September 12, 2014 01:01
mixerVesselAMI2D's mass is not balancing sharonyue OpenFOAM Running, Solving & CFD 6 June 10, 2013 10:34
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


All times are GMT -4. The time now is 23:53.