NSU3D Linear Solvers

The default solver in NSU3D is a nonlinear multigrid method. This solver provides high performance with very few tuning parameters, making it suitable for most applications and easy to configure.

Several additional linear solver options are available. Although these alternatives can sometimes offer improved robustness and faster convergence, they generally require more parameter tuning and a deeper understanding of the underlying numerical methods.

Linear Solver Options

There are three linear solver options available in NSU3D. These are selected using the parameter:

FSOLVER_TYPE = 1, 2, or 3

The solvers are ordered by increasing complexity and increasing number of tunable parameters:

  • FSOLVER_TYPE = 0 — Default nonlinear multigrid solver
  • FSOLVER_TYPE = 1 — Line/Gauss–Seidel linear solver (first-order approximate Jacobian)
  • FSOLVER_TYPE = 2 — GMRES solver preconditioned with Line/Gauss–Seidel (first-order approximate Jacobian)
  • FSOLVER_TYPE = 3 — Newton–Krylov GMRES solver (exact Jacobian, GMRES preconditioned with Line/Gauss–Seidel)

The FSOLVER_TYPE parameter is specified on each run line near the top of the NSU3D input file, as shown in the following example:

NSU3D INPUT FILE: LINEAR SOLVER CASE
RESTARTF  RESTARTT  RNTCYC
0.0        0.0       00.
RESTART FILE
none
MMESH     NTHREAD
1.0       1.0              (1st order = -1)
NCYC      NPRNT   N MESH   MESHLEVEL  CFLMIN  RAMPCYC  TURBFREEZE  FVIS2  FSOLVER_TYPE
100.      0.0       1.       3.0        1.0     0.0        0.        0.     0.0
100.      0.0       3.       2.0        1.0     0.0        0.        0.     0.0
100.      0.0       4.       1.0        1.0     0.0        0.        0.     0.0
200.      0.0       4.       1.0        1.0     0.0        0.        0.     1.0

If FSOLVER_TYPE is not specified, 0.0 is used (nonlinear multigrid).

Linear solvers are not supported on coarse multigrid levels (i.e., MESHLEVEL = 1.0 only).

Each linear solver requires its own set of parameters, placed directly above the MESH DATA FILE section in the input file:

----------------------------------------------------------------------
OPTIONAL LINEAR SOLVER
NCYC_LINEAR_MG   NCYC_LINEAR_FG   NCYC_LINEAR_CG   ISOLVE_LINEAR
1.                 -30.                0.               1.
----------------------------------------------------------------------
MESH DATA FILE
./grids/f6wbnc.part.160
----------------------------------------------------------------------

In general, it is recommended to use the least complex solver that performs well for the problem at hand.

Line/Gauss–Seidel Linear Solver (FSOLVER_TYPE = 1)

The following is an example input file configured for the Line/Gauss–Seidel Linear Solver:

Line 01: NSU3D INPUT FILE: LINEAR SOLVER CASE
Line 02: RESTARTF  RESTARTT  RNTCYC
Line 03: 0.0        0.0       00.
Line 04: RESTART FILE
Line 05: none
Line 06: MMESH     NTHREAD
Line 07: 1.0       1.0              (1st order = -1)
Line 08: NCYC      NPRNT     N MESH    MESHLEVEL   CFLMIN    RAMPCYC   TURBFREEZE   FVIS2  FSOLVER_TYPE
Line 09: 200.       0.0         4.        1.0        1.0       0.0       0.           0.      1.0
Line 10: CFL       CFLV      ITACC     INVBC     ITWALL    TWALL
Line 12: 1.0        1000.      0.0       0.0       0.0     0.0
Line 13: VIS 1     VIS 2     H FACTOR  SMOOP     NCYCSM
Line 14: 0.0        20.        0.00    0.00      0.0
Line 15: C1        C2        C3        C4        C5        C
Line 16: 0.5321    1.3711    2.7744
Line 17: FIL1      FIL2      FIL3      FIL4      FIL5      FIL6
Line 18: 1.0       1.0       1.0
Line 19: ----------------------------------------------------------------------
Line 20: COARSE LEVEL AND MULTIGRID PARAMETERS
Line 21: CFLC      CFLVC     SMOOPC    NSMOOC
Line 22: 1.0       1000.     0.0       0.0
Line 23: VIS0      MGCYC     SMOOMG    NSMOOMG
Line 24: 4.0       2.        0.8       2.0
Line 25: ----------------------------------------------------------------------
Line 26: TURBULENCE EQUATION(S)
Line 27: ITURB     IWALLF    WALLDIST
Line 28: 4.        0.0        1.0
Line 29: CT1       CT2        CT3      CT4       CT5       CT6
Line 30:  1.0      1.0        1.0      0.0       0.0
Line 31: CTC1      CTC2       CTC3     CTC4      CTC5      CTC6
Line 32: 1.0       1.0        1.0      0.0       0.0
Line 33: VIST0  TSMOOMG   NTSMOOMG
Line 34: 2.0        0.8        2.0
Line 35: ----------------------------------------------------------------------
Line 36: MACH      Z-ANGLE   Y-ANGLE   RE       RE_LENGTH
Line 37: 0.85       0.00       0.0     3000000.    141.2
Line 38: ----------------------------------------------------------------------
Line 39: FORCE/MOMENT COEFFICIENT PARAMETERS
Line 40: REF_AREA  REF_LENGTH XMOMENT  YMOMENT   ZMOMENT  ISPAN
Line 41: 72700.      141.2     504.9    0.0         0.0     2.0
Line 42: ----------------------------------------------------------------------
Line 43: OPTIONAL LINEAR SOLVER
Line 44: NCYC_LINEAR_MG   NCYC_LINEAR_FG   NCYC_LINEAR_CG   ISOLVE_LINEAR
Line 45: 1.                 -30.                0.               1.
Line 46: ----------------------------------------------------------------------
Line 47: MESH DATA FILE
Line 48: ./grids/f6wbnc.part.160
Line 49: ----------------------------------------------------------------------
Line 50: OPTIONAL PARAMETERS (MODIFY FROM DEFAULT VALUES SET IN set_lim_values.f)
Line 51: PARAMETER NAME                           VALUE(real number with decimal)
Line 52: PC_TOL                                    1.e-24
Line 53: CFL_MIN                                   10.0
Line 54: CFL_MAX                                   1.e+15
Line 55: CFL_GROWTH                                1.2

Parameter Overview

Required Parameters

Parameter Description
NCYC_LINEAR_MG Number of linear multigrid cycles per nonlinear cycle
NCYC_LINEAR_FG Fine-grid sweeps per linear cycle Negative → write out fine-grid subiteration history
NCYC_LINEAR_CG Coarse-grid sweeps per linear cycle Negative → write out coarse-grid histories
ISOLVE_LINEAR Identifies the solver type (1 for FSOLVER=1)

Optional Parameters

Parameter Description
PC_TOL Relative tolerance for terminating the linear solve
CFL_MIN Initial CFL value (default = 10.0)
CFL_MAX Maximum CFL value (default = 1.e15)
CFL_GROWTH CFL growth factor per nonlinear iteration (default = 1.2)

Using the Line/Gauss–Seidel Linear Solver

To activate this solver:

  1. Set FSOLVER_TYPE = 1.0 on the mesh line.

  2. Provide the required parameters:

    OPTIONAL LINEAR SOLVER
    NCYC_LINEAR_MG   NCYC_LINEAR_FG   NCYC_LINEAR_CG   ISOLVE_LINEAR
    1.               -30.             0.               1.
    

The header OPTIONAL LINEAR SOLVER enables the linear solver. ISOLVE_LINEAR = 1 indicates that the parameters are for FSOLVER_TYPE = 1.

Required Parameters Explained

The outer nonlinear iteration count is controlled by NCYC (line 9 of the input file).

The linear solver settings under the OPTIONAL LINEAR SOLVER section define the number of sweeps performed per nonlinear cycle.

Example configuration (single-grid mode):

  • NCYC_LINEAR_MG = 1
  • NCYC_LINEAR_FG = 30
  • NCYC_LINEAR_CG = 0

This performs 30 Line/Gauss–Seidel sweeps per nonlinear iteration.

Total fine-grid sweeps per nonlinear cycle:

NCYC_LINEAR_MG × NCYC_LINEAR_FG

Using Linear Multigrid

To enable linear multigrid:

OPTIONAL LINEAR SOLVER
NCYC_LINEAR_MG   NCYC_LINEAR_FG   NCYC_LINEAR_CG   ISOLVE_LINEAR
5.               -4.              4.               1.
  • 5 linear MG cycles per nonlinear iteration
  • Each MG cycle performs 4 fine-grid sweeps + coarse-grid sweeps
  • Number of multigrid levels is controlled by NMESH
  • MG cycle type is controlled by MGCYC - 1 = V-cycle - 2 = W-cycle

Optional Parameters Explained

Oversolving and CFL Scheduling

Oversolving the linear system (solving too accurately) often increases runtime without improving nonlinear convergence.

``PC_TOL`` A relative tolerance used to terminate the linear solve early. Useful for preventing oversolving.

CFL Scheduling CFL ramping is used to improve conditioning early in the run:

  • Start with CFL_MIN
  • Increase each nonlinear iteration by factor CFL_GROWTH
  • Stop increasing at CFL_MAX

Guidance:

  • Smaller CFL_MIN helps with early-iteration instabilities
  • Smaller CFL_MAX can help when convergence stalls
  • NCYC_LINEAR_FG < 0 enables printing linear residual history to aid tuning

Optimal Example Case

Below is an input file using linear multigrid linear solver that runs optimially on the F6 Test Case as described in this paper: https://scientific-sims.com/cfdlab/Dimitri_Mavriplis/HOME/assets/papers/nsu3d_paper.2014.pdf

NSU3D INPUT FILE: LINEAR SOLVER CASE
RESTARTF  RESTARTT  RNTCYC
0.0        0.0       00.
RESTART FILE
none
MMESH     NTHREAD
1.0       1.0              (1st order = -1)
NCYC      NPRNT     N MESH    MESHLEVEL   CFLMIN    RAMPCYC   TURBFREEZE   FVIS2  FSOLVER_TYPE
500.       0.0         4.        1.0        1.0       0.0       0.           0.      1.0
CFL       CFLV      ITACC     INVBC     ITWALL    TWALL
1.0        1000.      0.0       0.0       0.0     0.0
VIS 1     VIS 2     H FACTOR  SMOOP     NCYCSM
0.0        20.        0.00    0.00      0.0
C1        C2        C3        C4        C5        C
0.5321    1.3711    2.7744
FIL1      FIL2      FIL3      FIL4      FIL5      FIL6
1.0       1.0       1.0
----------------------------------------------------------------------
COARSE LEVEL AND MULTIGRID PARAMETERS
CFLC      CFLVC     SMOOPC    NSMOOC
1.0       1000.     0.0       0.0
VIS0      MGCYC     SMOOMG    NSMOOMG
4.0       2.        0.8       2.0
----------------------------------------------------------------------
TURBULENCE EQUATION(S)
ITURB     IWALLF    WALLDIST
4.        0.0        1.0
CT1       CT2        CT3      CT4       CT5       CT6
 1.0      1.0        1.0      0.0       0.0
CTC1      CTC2       CTC3     CTC4      CTC5      CTC6
1.0       1.0        1.0      0.0       0.0
VIST0  TSMOOMG   NTSMOOMG
2.0        0.8        2.0
----------------------------------------------------------------------
MACH      Z-ANGLE   Y-ANGLE   RE       RE_LENGTH
0.75       0.00       0.0     3000000.    141.2
----------------------------------------------------------------------
FORCE/MOMENT COEFFICIENT PARAMETERS
REF_AREA  REF_LENGTH XMOMENT  YMOMENT   ZMOMENT  ISPAN
72700.      141.2     504.9    0.0         0.0     2.0
----------------------------------------------------------------------
OPTIONAL LINEAR SOLVER
NCYC_LINEAR_MG   NCYC_LINEAR_FG   NCYC_LINEAR_CG   ISOLVE_LINEAR
3.                 -4.                 4.               1.
----------------------------------------------------------------------
MESH DATA FILE
./grids/f6wbnc.part.160
----------------------------------------------------------------------
OPTIONAL PARAMETERS (MODIFY FROM DEFAULT VALUES SET IN set_lim_values.f)
PARAMETER NAME                           VALUE(real number with decimal)
IN_SITU_POST_PROC                          0.0
PC_TOL                                     0.1