- dimProblem dimension
C++ Type:MooseEnum
Controllable:No
Description:Problem dimension
DomainAction
Set up the domain and compute devices.
Overview
DomainAction configures the FFT simulation domain and compute devices, and wires up the minimal runtime needed for Marlin problems:
Sets problem dimension and grid resolution ("dim", "nx", "ny", "nz") and computes grid spacing from "xmin"/"xmax", "ymin"/"ymax", "zmin"/"zmax".
Builds real-space axes (cell-centered) and reciprocal-space axes (via
fftfreq/rfftfreq, scaled by2π) and exposes helper accessors used throughout Marlin.Partitions the domain for parallel execution based on "parallel_mode" and optional "device_names"/"device_weights".
Creates a matching mesh automatically (optional) using "mesh_mode" and adds a
DomainMeshGenerator.Creates a
TensorProblemby default if one is not provided, enabling all Marlin objects to run.
Key concepts and behavior
Dimension and grids: The domain is a structured grid. Grid spacing is
(max-min)/nper axis; axes are built at cell centers. The reciprocal axes use Torch FFT frequency helpers and represent angular wavenumbers.Shapes and sizes: Methods such as
getShape(),getReciprocalShape(),getGridSize(),getReciprocalGridSize()provide local/global extents used by tensor computes and outputs.On-demand tensors:
getXGrid(),getKGrid(), andgetKSquare()lazily build coordinate arrays for the local partition when first requested.FFT helpers:
fft()/ifft()dispatch to serial or parallel implementations depending onparallel_mode. In serial, 1D/2D/3D transforms calltorch::fft::rfft{,2,n}and inverseirfft{,2,n}with appropriate dimension lists. Slab/pencil modes target distributed FFTs (pencil not yet implemented).Reductions:
sum()andaverage()reduce over the spatial dimensions. Note: reductions are implemented in serial; MPI reduction is not yet provided.Device and precision: If "device_names" are given, Marlin assigns a device per local host-rank and sets Torch floating precision with "floating_precision".
Mesh generation and problem creation
"mesh_mode" =
DOMAINgenerates a mesh with one element per grid cell;DUMMYcreates a single-element mesh spanning the domain;MANUALdisables automatic mesh creation (user supplies[Mesh]). When mesh creation is enabled,DomainActioninjectsSetupMeshActionand adds aDomainMeshGeneratorwith consistent domain bounds and resolution.If no
Problemis provided,DomainActioncreates aTensorProblemduringcreate_problem_customto ensure Marlin components can run.
Parallel partitioning modes
Parallel decomposition is a work in progress and not ready for production use!
NONE: No decomposition; requires running in serial (comm.size() == 1).FFT_SLAB: Slab decomposition for 2D/3D. Real space is partitioned into X–Z slabs stacked along Y; in Fourier space Y–Z slabs stacked along X. Requires one all-to-all per FFT.FFT_PENCIL: Intended for 3D pencil decomposition with two many-to-many communications per FFT. Not implemented yet.
Device assignment and weights
"device_names": Names in Torch syntax (e.g.,
"cuda:0","cuda:1","cpu"). For MPI runs, each process determines its local host-rank and picks a device by index (modulo the list length)."device_weights": Optional relative speeds to influence partitioning balance across local ranks. If omitted, weights default proportionally to the number of devices.
"floating_precision": Selects
DEVICE_DEFAULT,SINGLE, orDOUBLEprecision for Torch tensors on the chosen device.
Example Input File Syntax
Basic 2D domain with a dummy mesh and serial execution
[Domain<<<{"href": "../../syntax/Domain/index.html"}>>>]
dim<<<{"description": "Problem dimension"}>>> = 2
nx<<<{"description": "Number of elements in the X direction"}>>> = 10
ny<<<{"description": "Number of elements in the Y direction"}>>> = 10
mesh_mode<<<{"description": "Mesh generation mode."}>>> = DUMMY
parallel_mode<<<{"description": "Parallelization mode."}>>> = REAL_SPACE
periodic_directions<<<{"description": "Periodic directions of the simulation cell (controls halo exchange wrap-around)."}>>> = 'X Y'
[](test/tests/lbm/channel2D.i)3D domain with a dummy mesh
[Domain<<<{"href": "../../syntax/Domain/index.html"}>>>]
dim<<<{"description": "Problem dimension"}>>> = 3
nx<<<{"description": "Number of elements in the X direction"}>>> = 10
ny<<<{"description": "Number of elements in the Y direction"}>>> = 10
nz<<<{"description": "Number of elements in the Z direction"}>>> = 10
mesh_mode<<<{"description": "Mesh generation mode."}>>> = DUMMY
parallel_mode<<<{"description": "Parallelization mode."}>>> = REAL_SPACE
periodic_directions<<<{"description": "Periodic directions of the simulation cell (controls halo exchange wrap-around)."}>>> = 'X Y Z'
[](test/tests/lbm/channel3D.i)Parallel slab decomposition with explicit device selection and weights
[Domain<<<{"href": "../../syntax/Domain/index.html"}>>>]
device_names<<<{"description": "Compute devices to run on."}>>> = "cuda:1 cuda:0 cpu"
device_weights<<<{"description": "Device weights (or speeds) to influence the partitioning."}>>> = "10 10 1"
parallel_mode<<<{"description": "Parallelization mode."}>>> = FFT_SLAB
dim<<<{"description": "Problem dimension"}>>> = 2
nx<<<{"description": "Number of elements in the X direction"}>>> = 400
ny<<<{"description": "Number of elements in the Y direction"}>>> = 400
xmax<<<{"description": "Upper X Coordinate of the generated mesh"}>>> = '${fparse pi*2*30}'
ymax<<<{"description": "Upper Y Coordinate of the generated mesh"}>>> = '${fparse pi*2*30}'
[](test/tests/tensor_compute/parallel.i)Set up the domain and compute devices.
Input Parameters
- active__all__ If specified only the blocks named will be visited and made active
Default:__all__
C++ Type:std::vector<std::string>
Controllable:No
Description:If specified only the blocks named will be visited and made active
- debugFalseEnable additional debugging and diagnostics, such a checking for initialized tensors.
Default:False
C++ Type:bool
Controllable:No
Description:Enable additional debugging and diagnostics, such a checking for initialized tensors.
- device_namesCompute devices to run on.
C++ Type:std::vector<std::string>
Controllable:No
Description:Compute devices to run on.
- device_weightsDevice weights (or speeds) to influence the partitioning.
C++ Type:std::vector<unsigned int>
Controllable:No
Description:Device weights (or speeds) to influence the partitioning.
- floating_precisionDEVICE_DEFAULTFloating point precision.
Default:DEVICE_DEFAULT
C++ Type:MooseEnum
Controllable:No
Description:Floating point precision.
- gpu_aware_mpiFalseEnable GPU-aware MPI. If true, tensors will not be copied to the CPU before MPI communication. Requires a CUDA-aware MPI implementation.
Default:False
C++ Type:bool
Controllable:No
Description:Enable GPU-aware MPI. If true, tensors will not be copied to the CPU before MPI communication. Requires a CUDA-aware MPI implementation.
- inactiveIf specified blocks matching these identifiers will be skipped.
C++ Type:std::vector<std::string>
Controllable:No
Description:If specified blocks matching these identifiers will be skipped.
- mesh_modeDUMMYMesh generation mode.
Default:DUMMY
C++ Type:MooseEnum
Controllable:No
Description:Mesh generation mode.
- nx1Number of elements in the X direction
Default:1
C++ Type:unsigned int
Controllable:No
Description:Number of elements in the X direction
- ny1Number of elements in the Y direction
Default:1
C++ Type:unsigned int
Controllable:No
Description:Number of elements in the Y direction
- nz1Number of elements in the Z direction
Default:1
C++ Type:unsigned int
Controllable:No
Description:Number of elements in the Z direction
- parallel_modeFFT_AUTOParallelization mode.
Default:FFT_AUTO
C++ Type:MooseEnum
Controllable:No
Description:Parallelization mode.
- periodic_directionsPeriodic directions of the simulation cell (controls halo exchange wrap-around).
C++ Type:MultiMooseEnum
Controllable:No
Description:Periodic directions of the simulation cell (controls halo exchange wrap-around).
- xmax1Upper X Coordinate of the generated mesh
Default:1
C++ Type:double
Unit:(no unit assumed)
Controllable:No
Description:Upper X Coordinate of the generated mesh
- xmin0Lower X Coordinate of the generated mesh
Default:0
C++ Type:double
Unit:(no unit assumed)
Controllable:No
Description:Lower X Coordinate of the generated mesh
- ymax1Upper Y Coordinate of the generated mesh
Default:1
C++ Type:double
Unit:(no unit assumed)
Controllable:No
Description:Upper Y Coordinate of the generated mesh
- ymin0Lower Y Coordinate of the generated mesh
Default:0
C++ Type:double
Unit:(no unit assumed)
Controllable:No
Description:Lower Y Coordinate of the generated mesh
- zmax1Upper Z Coordinate of the generated mesh
Default:1
C++ Type:double
Unit:(no unit assumed)
Controllable:No
Description:Upper Z Coordinate of the generated mesh
- zmin0Lower Z Coordinate of the generated mesh
Default:0
C++ Type:double
Unit:(no unit assumed)
Controllable:No
Description:Lower Z Coordinate of the generated mesh
Optional Parameters
- control_tagsAdds user-defined labels for accessing object parameters via control logic.
C++ Type:std::vector<std::string>
Controllable:No
Description:Adds user-defined labels for accessing object parameters via control logic.
Advanced Parameters
Notes and Limitations
"parallel_mode" =
NONErequires a single-process run.FFT_PENCILis declared but not implemented; preferFFT_SLABfor distributed runs.sum()/average()use local reductions only; parallel reductions are not yet available.When "device_names" are omitted in MPI runs, the action aborts with an error to avoid ambiguous device assignment.
Related
DomainMeshGenerator: Mesh generator added automatically whenmesh_mode != MANUAL.TensorProblem: Created by default if the user does not provide a[Problem]compatible with Marlin.