Complete annotated example
The following snippet covers a typical 2D periodic simulation. See the sub-sections below for a full description of each parameter.input2d
Simulation parameters
Top-level scalars that control the overall simulation run.Fluid density shared by both phases. Used directly by
INSVCTwoFluidStaggeredHierarchyIntegrator.Number of grid cells along each axis on the coarsest level. The actual mesh spacing is
DX = L / N where L is the domain side length.Maximum number of multigrid levels used by the FAC preconditioner. Referenced inside
precond_db. Values of 5–7 are typical; larger values reduce cost on fine grids but require more setup.Number of predictor–corrector cycles per time step. Increasing this improves temporal accuracy at extra cost per step.
Maximum CFL number. Used together with
U_MAX and DX to derive DT_MAX = CFL_MAX * DX / U_MAX.Maximum allowed time step size. Can be set directly or derived from
CFL_MAX, DX, and U_MAX. The integrator may take smaller steps to satisfy stability constraints.Expected maximum velocity magnitude. Used only for computing
DT_MAX via the CFL condition. Set conservatively to avoid excessively large time steps.Enable solver logging output. Passed to both the fluid integrator and the advection–diffusion integrator.
Relaxation weight for the box-relaxation smoother inside the FAC preconditioner. Values between 0.5 and 1.0 are typical. Tune this together with
num_pre_sweeps and num_post_sweeps if convergence is slow.Enable the FAC multigrid preconditioner. Disabling this falls back to an unpreconditioned Krylov solve, which is significantly slower for large problems.
Physical time interval between visualization output files. VisIt dump files are written whenever
loop_time reaches the next multiple of this interval.Number of buffer cells added around tagged regions when generating refined patches. Increasing this produces larger refined patches and reduces regridding frequency.
Number of time steps between regridding operations. Lower values track moving interfaces more closely; higher values reduce overhead.
Fluid parameters
Physical coefficients for the network (n) and solvent (s) phases.Dynamic viscosity of the solvent phase. Appears in the viscous stress term for the solvent momentum equation.
Dynamic viscosity of the network phase. Appears in the viscous stress term for the network momentum equation.
Drag scaling factor for the network phase. Scales the drag force on the network:
f_drag = xi * nu_n * (us - un).Drag scaling factor for the solvent phase. Scales the drag force on the solvent:
f_drag = xi * nu_s * (un - us).Drag coefficient controlling momentum exchange between the two phases. Larger values enforce tighter velocity coupling. A common choice is
250.0 * ETA_S.Enable the viscoelastic (complex fluid) Oldroyd-B model. When
TRUE, a CFINSForcing block must also be present to configure the conformation tensor evolution. See the input2d.cf.relax example for a complete viscoelastic setup.XI can also be provided as a spatially varying field by calling setDragCoefficientFunction in C++ code rather than setting the scalar in the input file.Initial condition functions
The blocksun, us, p, and thn specify initial data using muParser expression strings. Variables X_0 and X_1 represent the spatial coordinates; t represents the current simulation time.
Initial network-phase velocity. Each component is a separate key:
function_0— x-componentfunction_1— y-component (2D) or y-component (3D)function_2— z-component (3D only)
Initial network volume fraction field. Uses a single
function key. The value must remain in [0, 1].An optional delta sub-key can be referenced inside the expression string and is set as a local variable before parsing:FN_FCN and FS_FCN follow the same component-based syntax and are optionally time-dependent:
INSVCTwoFluidStaggeredHierarchyIntegrator block
This sub-block configures the main fluid integrator. The block name must beINSVCTwoFluidStaggeredHierarchyIntegrator and is passed verbatim to MultiphaseStaggeredHierarchyIntegrator during construction.
Time-stepping scheme for the viscous terms.
TRAPEZOIDAL_RULE (Crank–Nicolson) is required for second-order accuracy.Enable gradient-based cell tagging for AMR refinement. When
TRUE, cells where the volume-fraction gradient exceeds grad_abs_thresh are tagged for refinement.Absolute gradient threshold for tagging cells. Can be a single scalar or a comma-separated list of per-level thresholds, e.g.
1.0, 4.0, 6.0.Convective limiter for the momentum equations. Supported values:
UPWIND, CUI, FBICS, MGAMMA. Defaults to the scheme configured in AdvDiffIntegrator if not set here.CartesianGeometry block
Defines the computational domain on a uniform Cartesian background mesh.Index space extents of the coarsest-level domain, e.g.
[(0,0), (N-1, N-1)] for a 2D N×N grid.Periodicity flag for each spatial dimension. Use
1 for periodic and 0 for non-periodic. Example: periodic_dimension = 1, 1 makes the domain doubly periodic.When non-periodic boundaries are used (
periodic_dimension = 0, 0), you must register muParserRobinBcCoefs objects via registerPhysicalBoundaryConditions. See Boundary conditions for details.GriddingAlgorithm block
Controls the AMR patch hierarchy structure.Total number of levels in the hierarchy, including the coarsest level. Level 0 is the coarsest; level
max_levels - 1 is the finest.Refinement ratio from each level to the level below it. Each entry is named
level_N and takes a comma-separated pair, e.g. level_1 = 2, 2 for 2× refinement in both directions.Minimum fraction of tagged cells that must fall inside a newly created patch. Lower values allow looser patches that cover more untagged cells.
Controls patch merging: if the total volume of smaller boxes is less than this fraction of the merged box volume, the boxes are combined.
Maximum patch dimensions at each level, e.g.
level_0 = 512, 512. Finer levels inherit the level-0 value unless overridden.