-
Notifications
You must be signed in to change notification settings - Fork 22
Function Object Route
The loadBalancedAMR function object provides an alternative to using adaptiveFvMesh for adaptive mesh refinement and load balancing. This is particularly useful when you need to combine AMR/LB with other dynamicFvMesh types, such as dynamicMotionSolverFvMesh for mesh motion.
This feature was added in STFS-TUDa/blastAMR#29.
As the dynamic mesh classes have been around for much longer, the function object should be considered as an "experimental" feature:
| Use Case | Recommended Approach |
|---|---|
| Simple AMR/LB |
adaptiveFvMesh (well tested) |
| Combining AMR with other mesh motion types |
loadBalancedAMR function object |
| Load balancing only (no AMR) | Either route works |
Add the following to system/controlDict:
libs (libamrFunctionObjects);
functions
{
loadBalancedAMR
{
type loadBalancedAMR;
libs (libamrFunctionObjects);
// Execution control (standard OpenFOAM function object settings)
executeControl timeStep;
executeInterval 1; // <- recommended to be 1 or some divisor of balanceInterval
// --- AMR Settings (same as adaptiveFvMesh) ---
refiner hexRefiner; // or polyRefiner
errorEstimator delta;
field alpha.water;
// Refinement control
refine true;
unrefine true;
maxRefinement 3;
lowerRefineLevel 0.01;
upperRefineLevel 0.99;
// --- Load Balancing ---
balance true;
allowableImbalance 0.1;
// --- Particle-aware settings (optional; these are the defaults) ---
loadPolicy cellCount;
particleCoeff 1.0;
minCellsPerProc 5;
}
}You also need a constant/dynamicMeshDict with a dynamicFvMesh type:
// For mesh motion
dynamicFvMesh dynamicMotionSolverFvMesh;
motionSolverLibs (libfvMotionSolvers);
motionSolver solidBody;
// ... motion solver settings ...
// Or for static topology (AMR handles refinement)
dynamicFvMesh staticFvMesh;Note
The function object requires the solver to have a dynamicFvMesh mesh. This constraint may be lifted as the code matures though.
All AMR/LB configuration options are documented on the Options Reference page. These options are shared between the adaptiveFvMesh and loadBalancedAMR function object routes.
Key differences for the function object route:
- Default
balanceisfalse(must be explicitly enabled) - Configuration is in
system/controlDictinstead ofconstant/dynamicMeshDict
libs
(
libamrDynamicMesh
libamrIndicators
libamrLoadPolicies
libamrCloudSupport // For Lagrangian support
libamrFunctionObjects // Required for function object route
);See tutorials/MPPICcolumn for a complete example of MPPIC particles with AMR and load balancing using the function object route.
“This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM® and OpenCFD® trade marks.”
This is blastAMR Wiki, here is a link back to Home