mesh_1d Module

The 1D solver is node-based finite-difference WENO. On a non-uniform grid the physical coordinate is mapped to a uniform computational grid ξ (Δξ = 1); the residual divides the flux difference by the per-node Jacobian J_i = dx/dξ rather than a scalar dx. This module owns the node coordinates and J.

Dependency rule: this module must NOT use config (config uses this module).



Derived Types

type, public ::  mesh_1d_t

Grid metrics for the 1D node-based scheme.

Read more…

Components

Type Visibility Attributes Name Initial
logical, public :: uniform = .true.
integer, public :: n_global = 0
real(kind=wp), public :: dx_uniform = 0.0_wp
real(kind=wp), public :: h_min = 0.0_wp
real(kind=wp), public :: h_left = 0.0_wp
real(kind=wp), public :: h_right = 0.0_wp
real(kind=wp), public, allocatable :: x_global(:)
real(kind=wp), public, allocatable :: jac_global(:)
real(kind=wp), public, allocatable :: x_node(:)
real(kind=wp), public, allocatable :: jac(:)
real(kind=wp), public, allocatable :: x_cell(:)

Cell-center coordinates for the FVM path. Allocated with bounds (1-h:n_cell+h) by build_mesh_cellcentered_1d.

real(kind=wp), public, allocatable :: dx_cell(:)

Cell widths for the FVM path (uniform: all equal dx). Allocated with bounds (1-h:n_cell+h) by build_mesh_cellcentered_1d.

real(kind=wp), public, allocatable :: x_cell_global(:)

Replicated GLOBAL cell-center coordinates for a NON-UNIFORM FVM grid (1:n_cell). Populated by build_mesh_cellcentered_global from the face positions stored in x_global; sliced per rank by build_mesh_cellcentered_local. Unallocated on the uniform FVM path, which recomputes cell centers analytically from x_left/x_right.

real(kind=wp), public, allocatable :: dx_cell_global(:)

Replicated GLOBAL cell widths for a NON-UNIFORM FVM grid (1:n_cell), the cell-centered twin of jac_global. See x_cell_global.


Subroutines

public subroutine read_node_coords(path, coords, n, is_ok, message)

Read strictly-increasing node coordinates from a text file. One value per line; blank lines and lines beginning with '#' are ignored.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: path
real(kind=wp), intent(out), allocatable :: coords(:)
integer, intent(out) :: n
logical, intent(out) :: is_ok
character(len=*), intent(out) :: message

public subroutine build_mesh_global(mesh, grid_type, grid_file, n_cell, x_left, x_right, is_ok, message)

Build the replicated global mesh; for file grids, derive n_cell/endpoints.

Arguments

Type IntentOptional Attributes Name
type(mesh_1d_t), intent(inout) :: mesh
character(len=*), intent(in) :: grid_type
character(len=*), intent(in) :: grid_file
integer, intent(inout) :: n_cell
real(kind=wp), intent(inout) :: x_left
real(kind=wp), intent(inout) :: x_right
logical, intent(out) :: is_ok
character(len=*), intent(out) :: message

public subroutine build_mesh_local(mesh, decomp)

Slice the replicated global mesh into this rank's local node arrays.

Arguments

Type IntentOptional Attributes Name
type(mesh_1d_t), intent(inout) :: mesh
type(decomp_t), intent(in) :: decomp

public subroutine build_mesh_cellcentered_1d(mesh, n_cell, x_left, x_right, halo_width)

Build cell-centered coordinates and widths for the FVM path.

Read more…

Arguments

Type IntentOptional Attributes Name
type(mesh_1d_t), intent(inout) :: mesh

Mesh object to populate (x_cell and dx_cell are set).

integer, intent(in) :: n_cell

Number of interior cells.

real(kind=wp), intent(in) :: x_left

Left domain boundary coordinate.

real(kind=wp), intent(in) :: x_right

Left domain boundary coordinate. Right domain boundary coordinate.

integer, intent(in) :: halo_width

Number of ghost-cell layers on each side (h >= 1).

public subroutine build_mesh_cellcentered_global(mesh, n_cell)

Build the replicated GLOBAL cell-centered mesh for a NON-UNIFORM FVM grid.

Read more…

Arguments

Type IntentOptional Attributes Name
type(mesh_1d_t), intent(inout) :: mesh

Mesh object; x_global (faces) must already be populated.

integer, intent(in) :: n_cell

Number of interior cells (= number of faces - 1).

public subroutine build_mesh_cellcentered_local(mesh, decomp, x_left, x_right)

Build this rank's local cell-centered coordinates and widths (FVM path).

Read more…

Arguments

Type IntentOptional Attributes Name
type(mesh_1d_t), intent(inout) :: mesh

Mesh object to populate (x_cell and dx_cell are set).

type(decomp_t), intent(in) :: decomp

This rank's decomposition (cell-counted for the FVM path).

real(kind=wp), intent(in) :: x_left

Left domain boundary coordinate.

real(kind=wp), intent(in) :: x_right

Left domain boundary coordinate. Right domain boundary coordinate.