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

Insert protectedCells manually

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree6Likes
  • 1 Post By Lorenzo210
  • 3 Post By clapointe
  • 2 Post By jairoandres

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 22, 2021, 06:31
Default Insert protectedCells manually
  #1
New Member
 
Lorenzo
Join Date: Apr 2020
Location: Italy
Posts: 28
Rep Power: 4
Lorenzo210 is on a distinguished road
Hi everyone!
I'm working on OpenFOAM v2012 with the solver interFoam and I'm struggling with a feature of dynamicRefineFvMesh.

I'd like to tell the solver not to refine a certain number of cells.
For example, let's say there is a two phase flow (liquid-vapour) inside a circular pipe, and the dynamic refinement is done at the interface. I want the solver to exclude the cells near the wall from refinement.

I know that dynamicRefineFvMesh automatically finds "non-hex" cells and collocates them inside the folder "constant/polymesh/sets" in a file called "protectedCells", so that it doesn't refine these cells during the simulation.

So, trying to adapt my request to the solver behaviour, I created a topoSetDict where I define a cellSet called "protectedCells" that includes all the cells I want to protect. This process gives me exactly the same file protectedCells inside the folder constant/polymesh/sets.

By the way, when I run the simulation (interFoam) it refines even inside the protectedCells! It seems that he doesn't read the protectedCells file if it is not created by the dynamic solver itself.
This can be seen in any DyM tutorial available by adding the topoSetDict and running the simulation.

I tried to look at some forum threads, but it seems that everyone had the opposite problem (they had protectedCells where they actually wanted refinement).

I gave a look at the source code, but it is not clear to me if actually he sees the definition of the cell regions inside the folder polymesh.

I hope someone could help me with this, if you knew what I can do to implement this feature it would be really helpful.

Regards,
Lorenzo
ahparvin likes this.
Lorenzo210 is offline   Reply With Quote

Old   February 22, 2021, 13:00
Default
  #2
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 13
clapointe is on a distinguished road
To hazard a guess, unless you tell the mesh/AMR about the protected cells created by topoSet, it won't do anything. The PDRFoamAutoRefine solver does something similar to what you are looking for, I think, with the following code :

Code:
// Test : disable refinement for some cells
bitSet& protectedCell =
refCast<dynamicRefineFvMesh>(mesh).protectedCell();

if (protectedCell.empty())
{
    protectedCell.setSize(mesh.nCells());
    protectedCell = false;
}

forAll(betav, celli)
{
    if (betav[celli] < 0.99)
    {
         protectedCell.set(celli);
    }
}
That code is used inside the solver, and updates the protectedCells based on betav value. You could probably replace the betav loop with a scan for near-wall cells. Assuming that your mesh boundary is not changing, you could take this snippet outside of the solver loop so that protectedCells is only modified once -- I'm not coming up with another easy way to do so offhand, but someone might have a better idea.

Caelan
Aabadani, Lorenzo210 and ahparvin like this.
clapointe is offline   Reply With Quote

Old   February 23, 2021, 05:42
Default
  #3
New Member
 
Lorenzo
Join Date: Apr 2020
Location: Italy
Posts: 28
Rep Power: 4
Lorenzo210 is on a distinguished road
Dear clapointe,

Thank you for answering so quickly. Your guess is really helpful and I'm grateful for that. My intent was to undestand how dynamicRefineFvMesh manages this set of cells, and I didn't think to look for examples of settings like you've shown.
I modified the solver and made little change so that it takes into account the distance of cell centres from the patch, and I managed to obtain the protection of cells near the wall.

Thank you again for helping me, have a nice day.

Lorenzo
Lorenzo210 is offline   Reply With Quote

Old   September 11, 2021, 14:15
Default
  #4
Member
 
Jairo A. Gutiérrez S
Join Date: Nov 2014
Posts: 50
Rep Power: 10
jairoandres is on a distinguished road
Check this out: dynamicRefineFvMesh - Protect cells from refinement (boundary)
Lorenzo210 and ahparvin like this.
jairoandres is offline   Reply With Quote

Reply

Tags
dynamic, interfoam, mesh, protectedcells, refinement

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Insert particle tracking Dshing CFX 2 May 20, 2019 04:57
[Other] How to Create and mesh a pipe with a porous tube insert mizzou OpenFOAM Meshing & Mesh Conversion 0 June 6, 2017 23:38
Insert Points in CFD-Post Supersonic ANSYS 3 August 26, 2016 02:45
[ICEM] Tips dealing with problem tets/tri manually without complete remesh FreeFall79 ANSYS Meshing & Geometry 5 November 19, 2013 18:52
3D Insert modelling in Mold Flow Dan Rößler Main CFD Forum 0 December 20, 2005 07:37


All times are GMT -4. The time now is 18:58.