Using the dynamicTopoFvMesh class inOpenFOAM
Sandeep Menon Kyle Mooney
Multi-phase Flow Simulation LaboratoryUniversity of Massachusetts Amherst
June 13 2011
Introduction
ExamplesI Leaky Faucet (free surface flow)I Micron Scale Droplet Collision (free surface flow)I Translating Circle (2D parallel remeshing)I Cylinder Intake Stroke (internal flow)I Store Separation (external flow & six-DOF)
Adaptive reconnection methodsI Mesh quality optimizationI Length scale resolution
Solution remappingParallel mesh reconnectionSetting Up A Case
I Configuring dynamicMeshDictI Running A Simulation
Slide: 2/31
Translating Circle in DomainNo Redistribution Redistribution every 100 time steps
Slide: 6/31
Store Separation Simulations
Slide: 9/31
Governing Equations
Integral Conservation Law for Moving / Deforming Control Volumes:
d
dt
∫V
ρφ dV +
∫S
n · ρ(v − vs)φ dS = −∫S
n · qφ dS +
∫V
sφ dV
Conservation of Mass:
d
dt
∫V
ρ dV +
∫S
n · ρ(v − vs) dS = 0
Conservation of Linear Momentum:
d
dt
∫V
ρv dV +
∫S
n · ρ(v − vs)v dS =
∫V
ρg dV +
∫S
n · σ dS
Space Conservation Law:
d
dt
∫V
dV −∫S
n · vs dS = 0
Slide: 10/31
Mesh Smoothing
Objectives:Continuously maintain mesh qualityNo changes to mesh connectivityDelay local re-meshing requirementsEasily incorporated into conservation laws
Spring Analogy Laplacian:∑j
kij(xij − xi) = 0
Laplacian Smoothing on Surfaces:
(I− nnT )∑j
kij(xij − xi) = 0
Slide: 11/31
Mesh Smoothing
Objectives:Continuously maintain mesh qualityNo changes to mesh connectivityDelay local re-meshing requirementsEasily incorporated into conservation laws
Spring Analogy Laplacian:∑j
kij(xij − xi) = 0
Laplacian Smoothing on Surfaces:
(I− nnT )∑j
kij(xij − xi) = 0
Slide: 11/31
Adaptive Mesh Reconnection
Reconnection for Improved Mesh QualityHandle excessive distortionUsed when mesh-motion algorithms are insufficientLocalized nature to avoid interpolation errorsOnly simplical 2D and 3D meshes considered
Reconnection for Length-Scale ResolutionAccurately capture physical phenomenaAchieve trade-off for computational cost vs. solution accuracy
Edge Swapping
Edge Bisection and Collapse
Slide: 12/31
Adaptive Mesh Reconnection
Reconnection for Improved Mesh QualityHandle excessive distortionUsed when mesh-motion algorithms are insufficientLocalized nature to avoid interpolation errorsOnly simplical 2D and 3D meshes considered
Reconnection for Length-Scale ResolutionAccurately capture physical phenomenaAchieve trade-off for computational cost vs. solution accuracy
Edge Swapping
Edge Bisection and Collapse
Slide: 12/31
Adaptive Mesh Reconnection
Reconnection for Improved Mesh QualityHandle excessive distortionUsed when mesh-motion algorithms are insufficientLocalized nature to avoid interpolation errorsOnly simplical 2D and 3D meshes considered
Reconnection for Length-Scale ResolutionAccurately capture physical phenomenaAchieve trade-off for computational cost vs. solution accuracy
Edge Swapping
Edge Bisection and Collapse
Slide: 12/31
Adaptive Mesh Reconnection
Reconnection for Improved Mesh QualityHandle excessive distortionUsed when mesh-motion algorithms are insufficientLocalized nature to avoid interpolation errorsOnly simplical 2D and 3D meshes considered
Reconnection for Length-Scale ResolutionAccurately capture physical phenomenaAchieve trade-off for computational cost vs. solution accuracy
Edge Swapping
Edge Bisection and Collapse
Slide: 12/31
Solution RemappingSupermesh
StepsCompute intersectionsCompute and limit gradients on source meshVolume and distance weighted Taylor series interpolate to supermeshAgglomeration on target mesh
StepsCompute intersectionsCompute and limit gradients on source meshVolume and distance weighted Taylor series interpolate to supermeshAgglomeration on target mesh
φ(xKb) =
1
VKb
[n∑i=1
{φKa+ (xiKc
− xKa) · (∇φ)Ka
}V iKc
]
Slide: 13/31
Solution RemappingSupermesh
StepsCompute intersectionsCompute and limit gradients on source meshVolume and distance weighted Taylor series interpolate to supermeshAgglomeration on target mesh
StepsCompute intersectionsCompute and limit gradients on source meshVolume and distance weighted Taylor series interpolate to supermeshAgglomeration on target mesh
φ(xKb) =
1
VKb
[n∑i=1
{φKa+ (xiKc
− xKa) · (∇φ)Ka
}V iKc
]
Slide: 13/31
Solution Remapping
Supermesh
StepsCompute intersectionsCompute and limit gradients on source meshVolume and distance weighted Taylor series interpolate to supermeshAgglomeration on target mesh
StepsCompute intersectionsCompute and limit gradients on source meshVolume and distance weighted Taylor series interpolate to supermeshAgglomeration on target mesh
φ(xKb) =
1
VKb
[n∑i=1
{φKa+ (xiKc
− xKa) · (∇φ)Ka
}V iKc
]
Slide: 13/31
Solution Remapping
Supermesh
StepsCompute intersectionsCompute and limit gradients on source meshVolume and distance weighted Taylor series interpolate to supermeshAgglomeration on target mesh
StepsCompute intersectionsCompute and limit gradients on source meshVolume and distance weighted Taylor series interpolate to supermeshAgglomeration on target mesh
φ(xKb) =
1
VKb
[n∑i=1
{φKa+ (xiKc
− xKa) · (∇φ)Ka
}V iKc
]
Slide: 13/31
Parallel Mesh Reconnection
Shared memory parallelismEntire memory is accessible to all compute nodesThread-safety is always a concernUsing the pthreads library for thread handlingLimited by memory bandwidth / capacity
Distributed memory parallelismEach compute node sees only its share of memoryInter-processor communication using MPITheoretically infinite memory capacity
Halo meshes
Slide: 14/31
Parallel Mesh Reconnection
Shared memory parallelismEntire memory is accessible to all compute nodesThread-safety is always a concernUsing the pthreads library for thread handlingLimited by memory bandwidth / capacity
Distributed memory parallelismEach compute node sees only its share of memoryInter-processor communication using MPITheoretically infinite memory capacity
Halo meshes
Slide: 14/31
Parallel Mesh Reconnection
Shared memory parallelismEntire memory is accessible to all compute nodesThread-safety is always a concernUsing the pthreads library for thread handlingLimited by memory bandwidth / capacity
Distributed memory parallelismEach compute node sees only its share of memoryInter-processor communication using MPITheoretically infinite memory capacity
Halo meshes
Slide: 14/31
Configuring dynamicMeshDict
Dictionary Organization:Smoothing and dynamicMesh Library SelectionSmoother OptionsDefine Explicit Patch MotionGeneral dynamicTopoFvMesh Options
I Refinement Options
Parallel Redistribution Options
Slide: 15/31
Configuring dynamicMeshDict
//- Select the type of dynamicFvMeshdynamicFvMesh dynamicTopoFvMesh;
//- Select the type of motionSolversolver mesquiteMotionSolver;
Slide: 17/31
Configuring mesquiteOptions Subdict.
mesquiteOptions{
//- Specify interval for surface smoothingsurfInterval 1;
//- Optimization metricoptMetric AspectRatioGamma;
//- Objective functionobjFunction LPtoP;
//- Optimization algorithmoptAlgorithm FeasibleNewton;
//- Termination criteria sub-dictionaries//- (takes default values if not specified)//- Specifying an empty sub-dictionary//- terminates with available optionstcInner{
absGradL2 1e-4;cpuTime 0.5;
}
Slide: 18/31
Configuring mesquiteOptions Subdict. cont.
//- Power value for the LPtoP objective functionpValue 2;power 2;
//- Specify a tolerance for the surface-smoothing CG solvertolerance 1e-2;
//- Specify number of CG sweeps for surface-smoothingnSweeps 2;
//- Specify slip patches for the motionSolverslipPatches{
sideWall;topWall;
}
Slide: 19/31
Configuring mesquiteOptions Subdict. cont.
//- Constrain surface mesh-motion on a specified cylindercylindricalConstraints{
//- Specify options per slip patchsideWall{
axisPoint (0.0 0.0 0.0);axisVector (0.0 0.0 1.0);radius 1.0;
}}
Slide: 20/31
Configuring mesquiteOptions Subdict cont.
//- Specify fixedValue patches for the motionSolverfixedValuePatches{
topWall{
type angularOscillatingDisplacement;amplitude -0.0125;//type oscillatingDisplacement;//amplitude (0 0 -0.01);axis (1 0 0);origin (0 0 3);angle0 0.0;omega 0.15;value uniform (0 0 0);
}}
Other fixedValuePatch types can be found here:/src/dynamicMesh/meshMotion/fvMotionSolver/pointPatchFields/derived//-End of Mesquite options
Slide: 21/31
Configuring dynamicTopoFvMesh
//- Options for dynamicTopoFvMeshdynamicTopoFvMesh{
//- Should all options be made mandatory?//- Useful for first-time use.allOptionsMandatory no;
//- Set run-time debug level [0-5]// debug 0;
//- Specify the number of threadsthreads 1;
//- Specify re-meshing interval//- Negative value implies no re-meshinginterval 1;
//- Specify whether the length-scale field//- should be dumped to diskdumpLengthScale false;
Slide: 22/31
Configuring dynamicTopoFvMesh
//- sliverThreshold specifies the//- quality criteria for sliver removal.sliverThreshold 0.35;
//- Should the tool attempt to remove slivers//- that fall below the sliverThreshold value?removeSlivers false;
//- Skip mapping step. Useful while using//- this tool as a pre-processor// skipMapping true;
// Toggle edgeRefinement on/offedgeRefinement yes;
//- If the number of modifications are to be limited, set this option// maxModifications 1000;
//- Load custom libraries for metrics// tetMetricLibs ("libtetMetrics.so");
//- Tetrahedral mesh quality metrictetMetric Knupp;
//- Avoid 2-2 swapping on certain patchesnoSwapPatches{}
Slide: 23/31
ConfiguringdynamicTopoFvMesh::refinementOptions
//- Options for edge-bisection/collapse.//- The edgeRefinement flag must be set for//- the following options to have effectrefinementOptions{
collapseRatio 0.5;bisectionRatio 1.5;growthFactor 1.03;
//- By default, existing boundary edge-lengths//- are used for length-scales.//- Length-scale can be fixed for certain patches.fixedLengthScalePatches{
topWall 0.2;bottomWall 0.2;sideWall 0.2;outlet 0.2;
}
Slide: 24/31
ConfiguringdynamicTopoFvMesh::refinementOptions
//- Avoid refinement on certain patches, if necessarynoModificationPatches{}
//- Set floating length-scale values on certain patchesfreeLengthScalePatches{}
//- Limit lengthScales to specified values, if necessary// minLengthScale 0.1;// maxLengthScale 0.3;
//- Field-based refinement options// fieldRefinement gamma;// fieldLengthScale 0.005;// lowerRefineLevel 0.001;// upperRefineLevel 0.999;// maxRefineLevel 4;// meanScale 0.015;
Slide: 25/31
Droplet Formation: Setup
Slide: 26/31
Droplet Formation: growthFactor
Slide: 27/31
Store Separation: Setup
Slide: 28/31
Fixed Displacement: Setup
Patch motion can be explicity perscribedin the motionSolver subdictionary
Slide: 29/31
Limitations
Topology changes on simplicial elements only (Tri & Tet)I Some success in mixed element meshes by tagging zones
for topo changes
Crushing CellsI Currently does not support cell “crushing”I Example: complete valve closure for cylinder simulationsI Potentially performed via coupling with a GGI patch
Serial version available in 1.6-ext release.Parallel redistribution still a little buggy. (Consider it Beta)
Slide: 30/31
Discussion and Future Work
Successful implementation of mesh-topology modificationalgorithmsHighly versatile application rangeConservative solution transferEfficient due to shared / distributed memory parallelizationFuture focus:
I Constrained, cost-effective remapping for divergence-free fluxesI Testing / validation of two-phase flowsI Handling of coalescence and separation regimes
Thank You
Slide: 31/31
Discussion and Future Work
Successful implementation of mesh-topology modificationalgorithms
Highly versatile application rangeConservative solution transferEfficient due to shared / distributed memory parallelizationFuture focus:
I Constrained, cost-effective remapping for divergence-free fluxesI Testing / validation of two-phase flowsI Handling of coalescence and separation regimes
Thank You
Slide: 31/31
Discussion and Future Work
Successful implementation of mesh-topology modificationalgorithmsHighly versatile application range
Conservative solution transferEfficient due to shared / distributed memory parallelizationFuture focus:
I Constrained, cost-effective remapping for divergence-free fluxesI Testing / validation of two-phase flowsI Handling of coalescence and separation regimes
Thank You
Slide: 31/31
Discussion and Future Work
Successful implementation of mesh-topology modificationalgorithmsHighly versatile application rangeConservative solution transfer
Efficient due to shared / distributed memory parallelizationFuture focus:
I Constrained, cost-effective remapping for divergence-free fluxesI Testing / validation of two-phase flowsI Handling of coalescence and separation regimes
Thank You
Slide: 31/31
Discussion and Future Work
Successful implementation of mesh-topology modificationalgorithmsHighly versatile application rangeConservative solution transferEfficient due to shared / distributed memory parallelization
Future focus:I Constrained, cost-effective remapping for divergence-free fluxesI Testing / validation of two-phase flowsI Handling of coalescence and separation regimes
Thank You
Slide: 31/31
Discussion and Future Work
Successful implementation of mesh-topology modificationalgorithmsHighly versatile application rangeConservative solution transferEfficient due to shared / distributed memory parallelizationFuture focus:
I Constrained, cost-effective remapping for divergence-free fluxesI Testing / validation of two-phase flowsI Handling of coalescence and separation regimes
Thank You
Slide: 31/31
Discussion and Future Work
Successful implementation of mesh-topology modificationalgorithmsHighly versatile application rangeConservative solution transferEfficient due to shared / distributed memory parallelizationFuture focus:
I Constrained, cost-effective remapping for divergence-free fluxesI Testing / validation of two-phase flowsI Handling of coalescence and separation regimes
Thank You
Slide: 31/31
Extra slides
Governing Equations
Newtonian Stress Tensor:
σ = −pI+ τ
τ = µ[∇v + (∇v)T ]
Incompressible Navier Stokes Equations:∫S
n · v dS = 0
d
dt
∫V
ρv dV +
∫S
n · ρ(v − vs)v dS =
∫V
ρg dV −∫V
∇p dV +
∫S
n · (µ∇v) dS
Conditions at a Fluid Interface
Dynamic Condition:∫S
n · σ2 dS −∫S
n · σ1 dS +
∫∂S
mσ dL = 0
Differential Form:
(p2 − p1)n− n · (τ 2 − τ 1) = ∇sσ + κσn
Normal Stress Balance:
(p2 − p1)− nn : (τ 2 − τ 1) = κσ
Tangential Stress Balance:
n · (τ 2 − τ 1)− n[nn : (τ 2 − τ 1)] = −∇sσ
Kinematic Condition:n · v2 − n · v1 = 0
Momentum transfer:
(I− nn) · v2 − (I− nn) · v1 = 0
Continuity of Velocity:v2 = v1
Conditions at a Fluid Interface
Dynamic Condition:∫S
n · σ2 dS −∫S
n · σ1 dS +
∫∂S
mσ dL = 0
Differential Form:
(p2 − p1)n− n · (τ 2 − τ 1) = ∇sσ + κσn
Normal Stress Balance:
(p2 − p1)− nn : (τ 2 − τ 1) = κσ
Tangential Stress Balance:
n · (τ 2 − τ 1)− n[nn : (τ 2 − τ 1)] = −∇sσ
Kinematic Condition:n · v2 − n · v1 = 0
Momentum transfer:
(I− nn) · v2 − (I− nn) · v1 = 0
Continuity of Velocity:v2 = v1
Conditions at a Fluid Interface
Dynamic Condition:∫S
n · σ2 dS −∫S
n · σ1 dS +
∫∂S
mσ dL = 0
Differential Form:
(p2 − p1)n− n · (τ 2 − τ 1) = ∇sσ + κσn
Normal Stress Balance:
(p2 − p1)− nn : (τ 2 − τ 1) = κσ
Tangential Stress Balance:
n · (τ 2 − τ 1)− n[nn : (τ 2 − τ 1)] = −∇sσ
Kinematic Condition:n · v2 − n · v1 = 0
Momentum transfer:
(I− nn) · v2 − (I− nn) · v1 = 0
Continuity of Velocity:v2 = v1
Mesh Smoothing
Local Optimization:Gauss-Seidel iteration over verticesMaximize quality of local cell-groupGlobal convergence is unclear
Global Optimization:Maximize quality of all elements simultaneouslyTypically involves large, sparse-matricesAttempts to find a global optimumMay not adequately penalize worst quality cells
Algebraic Mesh Quality Metric
Mean Ratio =12(3V 2)1/3∑6
i L2e
Mesh Smoothing
Local Optimization:Gauss-Seidel iteration over verticesMaximize quality of local cell-groupGlobal convergence is unclear
Global Optimization:Maximize quality of all elements simultaneouslyTypically involves large, sparse-matricesAttempts to find a global optimumMay not adequately penalize worst quality cells
Algebraic Mesh Quality Metric
Mean Ratio =12(3V 2)1/3∑6
i L2e
Mesh Smoothing
Local Optimization:Gauss-Seidel iteration over verticesMaximize quality of local cell-groupGlobal convergence is unclear
Global Optimization:Maximize quality of all elements simultaneouslyTypically involves large, sparse-matricesAttempts to find a global optimumMay not adequately penalize worst quality cells
Algebraic Mesh Quality Metric
Mean Ratio =12(3V 2)1/3∑6
i L2e
Solution RemappingRepeated remapping tests
Source field Inverse distance weighting
First order conservative Second order conservative
Adaptive Mesh Reconnection