solver_t Derived Type

type, public :: solver_t

solver class defines the Incompact3D algorithm at a very high level.

Procedures defined here that are part of the Incompact3D algorithm are: transeq, divergence, poisson, and gradient.

The operations these high level procedures require are provided by the relevant backend implementations.

transeq procedure obtains the derivations in x, y, and z directions using the transeq_x, transeq_y, and transeq_z operations provided by the backend. There are two different algorithms available for this operation, a distributed algorithm and the Thomas algorithm. At the solver class level it isn't known which algorithm will be executed, that is decided at run time and therefore backend implementations are responsible for executing the right subroutines.

Allocator is responsible from giving us a field sized array when requested. For example, when the derivations in x direction are completed and we are ready for the y directional derivatives, we need three fields to reorder and store the velocities in y direction. Also, we need three more fields for storing the results, and the get_block method of the allocator is used to arrange all these memory assignments. Later, when a field is no more required, release_block method of the allocator can be used to make this field available for later use.


Inherits

type~~solver_t~~InheritsGraph type~solver_t solver_t type~allocator_t allocator_t type~solver_t->type~allocator_t host_allocator type~base_backend_t base_backend_t type~solver_t->type~base_backend_t backend type~dirps_t dirps_t type~solver_t->type~dirps_t xdirps, ydirps, zdirps type~field_t field_t type~solver_t->type~field_t u, v, w, pressure, pressure_vert, dpdx_last, dpdy_last, dpdz_last, vort, qcrit type~flist_t flist_t type~solver_t->type~flist_t species type~ibm_t ibm_t type~solver_t->type~ibm_t ibm type~les_t les_t type~solver_t->type~les_t les type~mesh_t mesh_t type~solver_t->type~mesh_t mesh type~time_intg_t time_intg_t type~solver_t->type~time_intg_t time_integrator type~vector_calculus_t vector_calculus_t type~solver_t->type~vector_calculus_t vector_calculus type~allocator_t->type~field_t first type~base_backend_t->type~allocator_t allocator type~base_backend_t->type~mesh_t mesh type~poisson_fft_t poisson_fft_t type~base_backend_t->type~poisson_fft_t poisson_fft type~tdsops_t tdsops_t type~dirps_t->type~tdsops_t der1st, der1st_sym, der2nd, der2nd_sym, stagder_v2p, stagder_p2v, interpl_v2p, interpl_p2v, lowpass, lowpass_sym type~field_t->type~field_t next type~flist_t->type~field_t ptr type~ibm_t->type~allocator_t host_allocator type~ibm_t->type~base_backend_t backend type~ibm_t->type~field_t ep1 type~ibm_t->type~mesh_t mesh type~les_t->type~field_t nut, mixing_length_sq type~geo_t geo_t type~mesh_t->type~geo_t geo type~grid_t grid_t type~mesh_t->type~grid_t grid type~par_t par_t type~mesh_t->type~par_t par type~time_intg_t->type~allocator_t allocator type~time_intg_t->type~base_backend_t backend type~time_intg_t->type~flist_t olds type~vector_calculus_t->type~base_backend_t backend type~poisson_fft_t->type~mesh_t mesh

Inherited by

type~~solver_t~~InheritedByGraph type~solver_t solver_t type~base_case_t base_case_t type~base_case_t->type~solver_t solver type~case_abl_t case_abl_t type~case_abl_t->type~base_case_t type~case_channel_t case_channel_t type~case_channel_t->type~base_case_t type~case_cylinder_t case_cylinder_t type~case_cylinder_t->type~base_case_t type~case_generic_t case_generic_t type~case_generic_t->type~base_case_t type~case_tgv_t case_tgv_t type~case_tgv_t->type~base_case_t type~case_wind_turbine_t case_wind_turbine_t type~case_wind_turbine_t->type~base_case_t

Components

Type Visibility Attributes Name Initial
real(kind=dp), public :: dt
real(kind=dp), public :: nu
real(kind=dp), public, dimension(:), allocatable :: nu_species
integer, public :: n_iters
integer, public :: n_output
integer, public :: current_iter = 0
integer, public :: ngrid
integer, public :: nvars = 3
integer, public :: nspecies = 0
class(field_t), public, pointer :: u
class(field_t), public, pointer :: v
class(field_t), public, pointer :: w
class(field_t), public, pointer :: pressure => null()

Pressure on CELL grid (DIR_Z)

class(field_t), public, pointer :: pressure_vert => null()

Pressure on VERT grid (DIR_X)

logical, public :: keep_pressure = .false.

If true, persist pressure for output

logical, public :: keep_wall_correction = .false.

If true, persist the last pressure gradient for precorrect_walls

class(field_t), public, pointer :: dpdx_last => null()

Last projection's velocity correction, kept when the mesh has a Dirichlet face so precorrect_walls can reuse it. Only kept when keep_wall_correction is set, as it costs three extra fields.

class(field_t), public, pointer :: dpdy_last => null()
class(field_t), public, pointer :: dpdz_last => null()
real(kind=dp), public :: dp_last_dt = 0._dp

Substep timestep (time_intg_t%stage_dt) the kept correction was made with, so precorrect_walls can rescale it to the current substep.

class(field_t), public, pointer :: vort => null()

Vorticity magnitude on VERT grid

class(field_t), public, pointer :: qcrit => null()

Q-criterion on VERT grid

type(flist_t), public, dimension(:), pointer :: species => null()
class(base_backend_t), public, pointer :: backend
type(mesh_t), public, pointer :: mesh
type(time_intg_t), public :: time_integrator
type(allocator_t), public, pointer :: host_allocator
type(dirps_t), public, pointer :: xdirps
type(dirps_t), public, pointer :: ydirps
type(dirps_t), public, pointer :: zdirps
type(vector_calculus_t), public :: vector_calculus
type(ibm_t), public :: ibm
type(les_t), public :: les
logical, public :: ibm_on
logical, public :: spatial_filter = .false.

explicit low-pass filter on velocity

procedure(poisson_solver), public, pointer :: poisson => null()
procedure(transport_equation), public, pointer :: transeq => null()

Constructor

public interface solver_t

  • public function init(backend, mesh, host_allocator) result(solver)

    Arguments

    Type IntentOptional Attributes Name
    class(base_backend_t), intent(inout), target :: backend
    type(mesh_t), intent(inout), target :: mesh
    type(allocator_t), intent(inout), target :: host_allocator

    Return Value type(solver_t)


Type-Bound Procedures

procedure, public :: transeq_species

  • public subroutine transeq_species(self, rhs, variables)

    Skew-symmetric form of convection-diffusion terms in the species equation. Inputs from velocity grid and outputs to velocity grid.

    Arguments

    Type IntentOptional Attributes Name
    class(solver_t) :: self
    type(flist_t), intent(inout) :: rhs(:)
    type(flist_t), intent(in) :: variables(:)

procedure, public :: apply_les

  • public subroutine apply_les(self, rhs, variables)

    Add the configured explicit SGS closure to the momentum RHS.

    Arguments

    Type IntentOptional Attributes Name
    class(solver_t), intent(inout) :: self
    type(flist_t), intent(inout) :: rhs(:)
    type(flist_t), intent(in) :: variables(:)

procedure, public :: apply_spatial_filter

  • public subroutine apply_spatial_filter(self)

    Apply the explicit low-pass filter to the velocity, as Incompact3d does for wall-modelled ABL runs (ifilter=1, C_filter).

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(solver_t), intent(inout) :: self

procedure, public :: finalise

  • public subroutine finalise(self)

    Release resources owned by the solver and its runtime models.

    Arguments

    Type IntentOptional Attributes Name
    class(solver_t), intent(inout) :: self

procedure, public :: pressure_correction

procedure, public :: precorrect_walls

  • public subroutine precorrect_walls(self, u, v, w)

    Incompact3d's pre_correc: on each Dirichlet face, add the previous projection's tangential correction to the value set by the case. The projection that follows then leaves the face at its prescribed value plus dt(grad p_old - grad p_new), instead of -dtgrad p_new. The kept correction is dt_last*grad p_old, so it is rescaled by dt_now/dt_last first, as Incompact3d does with gdt(itr). The timestep is time_intg_t%stage_dt, the time the substep has advanced from the divergence-free start of the step, which is what the projection scales its correction by. For AB this ratio is always 1; for RK it changes between stages (1/2, 3/4, 1 for RK3). Before the first projection (or after a restart, as in Incompact3d) there is no correction to add.

    Arguments

    Type IntentOptional Attributes Name
    class(solver_t) :: self
    class(field_t), intent(inout) :: u
    class(field_t), intent(inout) :: v
    class(field_t), intent(inout) :: w

procedure, public :: divergence_v2p

  • public subroutine divergence_v2p(self, div_u, u, v, w)

    Wrapper for divergence_v2p

    Arguments

    Type IntentOptional Attributes Name
    class(solver_t) :: self
    class(field_t), intent(inout) :: div_u
    class(field_t), intent(in) :: u
    class(field_t), intent(in) :: v
    class(field_t), intent(in) :: w

procedure, public :: gradient_p2v

  • public subroutine gradient_p2v(self, dpdx, dpdy, dpdz, pressure)

    Wrapper for gradient_p2v

    Arguments

    Type IntentOptional Attributes Name
    class(solver_t) :: self
    class(field_t), intent(inout) :: dpdx
    class(field_t), intent(inout) :: dpdy
    class(field_t), intent(inout) :: dpdz
    class(field_t), intent(in) :: pressure

procedure, public :: curl

  • public subroutine curl(self, o_i_hat, o_j_hat, o_k_hat, u, v, w)

    Wrapper for curl

    Arguments

    Type IntentOptional Attributes Name
    class(solver_t) :: self
    class(field_t), intent(inout) :: o_i_hat

    Vector components of the output vector field Omega

    class(field_t), intent(inout) :: o_j_hat

    Vector components of the output vector field Omega

    class(field_t), intent(inout) :: o_k_hat

    Vector components of the output vector field Omega

    class(field_t), intent(in) :: u
    class(field_t), intent(in) :: v
    class(field_t), intent(in) :: w