|
[Sponsors] |
[AMR] Adaptive mesh refinement only within a cell set |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 21, 2021, 11:22 |
[AMR] Adaptive mesh refinement only within a cell set
|
#1 |
New Member
Edwin Rajeev
Join Date: Dec 2019
Location: Florida
Posts: 15
Rep Power: 7 |
Hi all,
I am currently running a 3D VOF simulation to study wave interaction with a breakwater structure. I intend to use AMR to refine the interface only in the breakwater region and not the entire domain. Is it possible to use topoSet to define the region and use AMR only on the prescribed cell set? Thank you and Regards |
|
July 21, 2021, 12:48 |
|
#2 |
Senior Member
Join Date: Aug 2015
Posts: 494
Rep Power: 15 |
It is -- I've done something similar in the past, well the opposite, really, but it gets the job done if I remember correctly. Based on code from PDRFoam (the amr version) we can protect some initial cell set from refinement (this way the cell set doesn't need to be updated as the mesh changes, because it shouldn't change). It looks something like this :
Code:
// Test : disable refinement for some cells PackedBoolList& protectedCell = refCast<dynamicRefineBalanceMultiRegionFvMesh>(mesh).protectedCell(); if (protectedCell.empty()) { protectedCell.setSize(mesh.nCells()); protectedCell = 0; } cellSet protectedCells ( IOobject ( "protectedCells", "constant/polyMesh/sets", mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ); forAll (mesh.C(), celli) { if (protectedCells[celli]) { protectedCell[celli] = 1; } } Caelan
__________________
Public git repository : https://github.com/clapointe2011/public |
|
July 21, 2021, 14:07 |
|
#3 |
New Member
Edwin Rajeev
Join Date: Dec 2019
Location: Florida
Posts: 15
Rep Power: 7 |
Thank you so much Caelan. This is great. I will try and implement this in waves2Foam and see if it works properly.
Additionally, as you mentioned what would be your suggestion on implementing this in dynamicRefineMesh? This could be quite a handy tool from a general standpoint. Thanks |
|
July 21, 2021, 14:11 |
|
#4 |
Senior Member
Join Date: Aug 2015
Posts: 494
Rep Power: 15 |
Off the top of my head, you'd likely add similar code to the initialization bit of the dynamicRefineFvMesh code -- simply updating the protectedCells list inside there instead of on the solver end.
Caelan
__________________
Public git repository : https://github.com/clapointe2011/public |
|
February 27, 2023, 21:31 |
Code tested in SprayFoam
|
#5 |
Member
Jairo A. Gutiérrez S
Join Date: Nov 2014
Posts: 60
Rep Power: 12 |
Thank you a lot. I want to mention that I tested the code (used parts of it you placed in another forum thread), which worked well under sprayFoam (or sprayDyMFoam) in OpenFOAM V2012.
Requirements: 1. to #include "dynamicRefineFvMesh.H" just after the base library is included (dynamicFvMesh) 2. to #include "cellSet.H" 3. This part of the code "protectedCells" is the name of the cellSet you are creating in toposetDict: Code:
cellSet protectedCells Code:
"protectedCells", "6e-05/polyMesh/sets", Here is the complete piece of code: Code:
bitSet& protectedCell = refCast<dynamicRefineFvMesh>(mesh).protectedCell(); if (protectedCell.empty()) { protectedCell.setSize(mesh.nCells()); protectedCell = false; } cellSet protectedCells ( IOobject ( "protectedCells", "6e-05/polyMesh/sets", mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ); forAll (mesh.C(), celli) { if (protectedCells[celli]) { protectedCell[celli] = 1; } } J.A. Gutiérrez. Ps: Last piece of advice: Remember you can add multiple regions to the same cellSet using "new" for the first and then "add" for the other definitions, i.e.: Code:
{ name protectedCells; type cellSet; action new; source cylinderToCell; p1 (0 0 0); p2 (0 -0.5 0); radius 0.125; } { name protectedCells; type cellSet; action add; source cylinderToCell; p1 (0 0 0); p2 (0 -0.2 0); radius 0.19; } |
|
Tags |
adaptive mesh refinement, mesh, vof, waves |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[snappyHexMesh] snappyHexMesh stuck when snap is turned on | yukuns | OpenFOAM Meshing & Mesh Conversion | 3 | February 2, 2021 14:05 |
SimpleFoam & Theater | jipai | OpenFOAM Running, Solving & CFD | 3 | June 18, 2019 11:11 |
[snappyHexMesh] Number of cells in mesh don't match with size of cellLevel | colinB | OpenFOAM Meshing & Mesh Conversion | 14 | December 12, 2018 09:07 |
[snappyHexMesh] Removing further cells after SHM | zonda | OpenFOAM Meshing & Mesh Conversion | 14 | September 15, 2017 08:50 |
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! | sc298 | OpenFOAM Meshing & Mesh Conversion | 2 | March 27, 2011 22:11 |