This example was inspired by the report of Anne Kösters: Dynamic mesh refinement in dieselFoam. Here you will find source code of the icoDyMFoam solver, cavity3d example case (note, that dymicRefineFvMesh class does not work with 2D case).
So, we have standard cavity case extruded in Oz direction. Initial conditions and BCs are the same. Additionally we have passive scalar T, initialized at the center of cavity within a 0.02x0.02x0.02 m3 box with identity value. Diffusion coefficient is defined, so the scalar is transported and diffused within the time. Mesh refinement is made for the cells where T =0.5 ... 1.
For the unrefined mesh on the coarse grid transported scalar is almost diffused for the time range till 0.5 seconds. Media:IcoDyMFoam_norefine.gif
Check what we've got with mesh refinement. Media:IcoDyMFoam_cavity3d.gif
Be aware of the small time step, because we do not make Courant number control, and refined cell can be pretty small!
The src files rearranged a little, this example can be compiled and run with foam-extend 3.0/3.1 with only modification to Make/options by changing:
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \
- 28-05-2011: Initial upload
--Makaveli lcf 23:53, 28 May 2011 (CEST)