# 3. Input File

PMR supports two input file formats (both YAML) - the legacy Nalu input files and the new more compact PMR syntax. We recommend using the PMR syntax for any new or modified cases, so this format is the only one described below.

Note

PMR uses a YAML input file, which means that commands are case-sensitive and indentation matters. Use spaces for indentation, not tabs.

## 3.1. Linear Solver

The linear solver will default to gmres with a sgs preconditioner if not specified. To change any of the arguments, add a `linear_solver` block (shown below) with the relevant line commands. Any line commands not included will use the default values.

    linear_solver:
      method: gmres
      preconditioner: sgs
      num_sweeps: 3
      damping_factor: 0.7
      tolerance: 1e-5
      max_iterations: 100
      kspace: 100
      output_level: 0

Note

MueLu-based preconditioners offer the best scalability, especially for larger problem sizes. Parameters for `preconditioner: muelu` are read from `muelu_pmr.xml`, if it exists. If missing, reasonable default parameters are provided to the user.

Supported solver options include (but are not limited to) the values in the table below:

Table 3.1 Solver options
Option | Valid Parameters
--- | ---
method | `gmres` `bicgstab` `gcrodr`
preconditioner | `jacobi` `sgs` `sgs2` `muelu`
num_sweeps | Integer number of preconditioner sweeps
tolerance | Linear solver tolerance
damping_factor | Preconditioner damping factor (scalar from 0 to 1)
max_iterations | Maximum number of linear solver iterations
kspace | K-space (restart) iterations for solver
output_level | Integer for output verbosity (higher = more verbose)

Note

Nalu did not report solver failures, so they were silently ignored. The prior default solver used in Nalu used 1 sweep and no damping, which can struggle to converge for some PMR problems. Increasing to 3 sweeps and setting a damping factor of 0.7 can improve the solver robustness. The two-stage SGS preconditioner (sgs2) is an alternative to SGS meant for better performance on GPU architectures. SGS does not work with batching and does not perform well on GPU systems.

## 3.2. Simulation Settings

The simulation settings block is the only required block in the PMR input file. This is where you specify the name of the mesh to use (required), decomposition method (optional), the advection operator method (required), the quadrature type (required), and nonlinear settings (optional).

    simulation_settings:
      mesh: pmr.g
      decomposition_method: rcb
      method: edge_upwind

      nonlinear_settings:
        max_iterations: 1
        convergence_tolerance: 1e-6

      quadrature:
        type: thurgood
        order: 4

### 3.2.1. Solution Method

The following solution methods are supported for the `method:` argument:

- `edge_upwind` (or `edge upwind` or `edge_upw`) - Use an edge-based discretization with upwind stabilization (faster, first order).

- `edge_sucv` (or `edge sucv`) - Use an edge-based discretization with SUCV stabilization (second order).

- `elem_sucv` (or `elem sucv`) - Use an element-based discretization with SUCV stabilization (second order). Using this option allows linear system rotation so the linear system does not need to be re-assembled for each ordinate direction.

### 3.2.2. Quadrature Type

The supported quadrature types are listed below. All types except for user-defined require an `order` parameter as well as the type.

- `thurgood` - Uses the Thurgood triangulation-based quadrature with ordinate directions

- `levelsymmetric` (or `level_symmetric`) - Uses the level symmetric quadrature with ordinate directions. The order must be one of 2, 4, 6, 8, 12, or 16.

- `pntn` - Uses the Legendre-Chebyshev (PN-TN) quadrature rule with ordinate directions. The quadrature order must be even.

- `userdefined` (or `user_defined`) - Reads a CSV file of user-defined quadrature directions and weights. The CSV file should list the number of ordinate directions on the first line, and all subsequent lines must be `nx, ny, nz, weight`. The weights must sum to . An example file is shown below. The user defined quadrature takes a file name instead of an order argument like the other types. If omitted, this defaults to “user_quadrature.csv”.

      4
      1, 0, 0, 3.141
      0, 1, 0, 3.141
      0, 0, 1, 3.141
      -1, 0, 0, 3.141

      quadrature:
        type: user_defined
        file: my_quadrature.csv

## 3.3. Post-Processing

PMR supports doing integrals and averages of scalar fields on sidesets (internal or external). Each post-processor is defined with either an `integral` or `average` block, and must have a `field`, `target_name`, and `output_name` specified. The `target_name` argument can be a single sideset or a list of sidesets. The calculated quantities are sent to the fluid code, which registers them as global variables available for output.

Note

Post-processed global variables cannot be output directly by PMR, they are only sent to the calling fluid code.

    post_process:
    - integral:
        field: irradiation
        target_name: surface_1
        output_name: int_irr1
    - average:
        field: irradiation_opp
        target_name: [surface_1, surface_2]
        output_name: int_irr1_opp

When doing a spectral solve, the fluid code determines the naming scheme for the per-band quantities. For example, when coupling with Fuego, the above example would produce `int_irr1_B0`, `int_irr1_B1`, etc as well as a band sum saved as the original name (`int_irr1`).

The field specified must be an existing field, with one exception. Since irradiation is a directionally dependent quantity, on internal sidesets you may want to calculate irradiation from either side. Post-processing `irradiation_opp` will post-process irradiation with the opposite normal convention on the requested sideset(s).

## 3.4. Output Settings

Typically the fields of interest are transferred to the fluid code and output there, but an optional output settings block can be included in the PMR input file to output fields from PMR directly. Only nodal fields can be output from PMR.

    results_output:
      output_filename: pmr_out.e
      output_frequency: 2
      output_variables:
        - absorption_coefficient
        - scalar_flux
        - radiative_heat_flux
        - radiation_source
        - div_radiative_heat_flux
        - irradiation
        - emissivity
        - transmissivity