m_base_case Module

Provides the base case for running a simulation. New cases are implemented by extending this to specify the initial and boundary conditions, forcing terms and case-specific postprocessing and analysis.


Uses

  • module~~m_base_case~~UsesGraph module~m_base_case m_base_case m_mpi m_mpi module~m_base_case->m_mpi module~m_allocator m_allocator module~m_base_case->module~m_allocator module~m_base_backend m_base_backend module~m_base_case->module~m_base_backend module~m_common m_common module~m_base_case->module~m_common module~m_config m_config module~m_base_case->module~m_config module~m_field m_field module~m_base_case->module~m_field module~m_io_manager m_io_manager module~m_base_case->module~m_io_manager module~m_logger m_logger module~m_base_case->module~m_logger module~m_mesh m_mesh module~m_base_case->module~m_mesh module~m_monitoring m_monitoring module~m_base_case->module~m_monitoring module~m_postprocess m_postprocess module~m_base_case->module~m_postprocess module~m_solver m_solver module~m_base_case->module~m_solver module~m_allocator->module~m_common module~m_allocator->module~m_field module~m_base_backend->m_mpi module~m_base_backend->module~m_allocator module~m_base_backend->module~m_common module~m_base_backend->module~m_field module~m_base_backend->module~m_logger module~m_base_backend->module~m_mesh iso_c_binding iso_c_binding module~m_base_backend->iso_c_binding module~m_poisson_fft m_poisson_fft module~m_base_backend->module~m_poisson_fft module~m_tdsops m_tdsops module~m_base_backend->module~m_tdsops module~m_common->m_mpi module~m_common->module~m_logger module~m_config->module~m_common module~m_config->module~m_logger iso_fortran_env iso_fortran_env module~m_config->iso_fortran_env module~m_field->module~m_common module~m_field->iso_c_binding module~m_io_manager->m_mpi module~m_io_manager->module~m_solver module~m_checkpoint_manager m_checkpoint_manager module~m_io_manager->module~m_checkpoint_manager module~m_checkpoint_state m_checkpoint_state module~m_io_manager->module~m_checkpoint_state module~m_snapshot_manager m_snapshot_manager module~m_io_manager->module~m_snapshot_manager module~m_stats m_stats module~m_io_manager->module~m_stats module~m_logger->m_mpi module~m_logger->iso_fortran_env module~m_mesh->m_mpi module~m_mesh->module~m_common module~m_mesh->module~m_field module~m_mesh->module~m_logger module~m_mesh_content m_mesh_content module~m_mesh->module~m_mesh_content module~m_monitoring->module~m_common module~m_monitoring->module~m_field module~m_monitoring->module~m_logger module~m_monitoring->module~m_solver module~m_scalar_series m_scalar_series module~m_monitoring->module~m_scalar_series module~m_postprocess->module~m_common module~m_postprocess->module~m_field module~m_postprocess->module~m_logger module~m_postprocess->module~m_solver module~m_solver->module~m_allocator module~m_solver->module~m_base_backend module~m_solver->module~m_common module~m_solver->module~m_config module~m_solver->module~m_field module~m_solver->module~m_logger module~m_solver->module~m_mesh module~m_ibm m_ibm module~m_solver->module~m_ibm module~m_les m_les module~m_solver->module~m_les module~m_solver->module~m_tdsops module~m_tdsops_setup m_tdsops_setup module~m_solver->module~m_tdsops_setup module~m_time_integrator m_time_integrator module~m_solver->module~m_time_integrator module~m_vector_calculus m_vector_calculus module~m_solver->module~m_vector_calculus module~m_checkpoint_manager->m_mpi module~m_checkpoint_manager->module~m_common module~m_checkpoint_manager->module~m_config module~m_checkpoint_manager->module~m_field module~m_checkpoint_manager->module~m_logger module~m_checkpoint_manager->module~m_solver module~m_checkpoint_manager->module~m_checkpoint_state module~m_checkpoint_manager->module~m_stats module~m_io_field_utils m_io_field_utils module~m_checkpoint_manager->module~m_io_field_utils module~m_io_session m_io_session module~m_checkpoint_manager->module~m_io_session module~m_checkpoint_state->module~m_io_session module~m_ibm->m_mpi module~m_ibm->module~m_allocator module~m_ibm->module~m_base_backend module~m_ibm->module~m_common module~m_ibm->module~m_field module~m_ibm->module~m_logger module~m_ibm->module~m_mesh module~m_ibm->module~m_io_session module~m_les->module~m_base_backend module~m_les->module~m_common module~m_les->module~m_config module~m_les->module~m_field module~m_les->module~m_logger module~m_les->module~m_mesh module~m_les->module~m_tdsops module~m_mesh_content->module~m_common module~m_mesh_content->module~m_logger module~m_poisson_fft->module~m_common module~m_poisson_fft->module~m_field module~m_poisson_fft->module~m_logger module~m_poisson_fft->module~m_mesh module~m_poisson_fft->module~m_tdsops module~m_scalar_series->module~m_common module~m_scalar_series->module~m_logger module~m_snapshot_manager->m_mpi module~m_snapshot_manager->module~m_common module~m_snapshot_manager->module~m_config module~m_snapshot_manager->module~m_field module~m_snapshot_manager->module~m_logger module~m_snapshot_manager->module~m_solver module~m_snapshot_manager->module~m_io_field_utils module~m_snapshot_manager->module~m_io_session module~m_stats->module~m_common module~m_stats->module~m_config module~m_stats->module~m_field module~m_stats->module~m_logger module~m_stats->module~m_solver module~m_stats->module~m_io_session module~m_tdsops->module~m_common module~m_tdsops->module~m_logger module~m_tdsops_setup->module~m_base_backend module~m_tdsops_setup->module~m_common module~m_tdsops_setup->module~m_logger module~m_tdsops_setup->module~m_mesh module~m_tdsops_setup->module~m_tdsops module~m_time_integrator->module~m_allocator module~m_time_integrator->module~m_base_backend module~m_time_integrator->module~m_common module~m_time_integrator->module~m_field module~m_time_integrator->module~m_logger module~m_vector_calculus->module~m_allocator module~m_vector_calculus->module~m_base_backend module~m_vector_calculus->module~m_common module~m_vector_calculus->module~m_field module~m_vector_calculus->module~m_logger module~m_vector_calculus->module~m_tdsops module~m_io_field_utils->module~m_common module~m_io_field_utils->module~m_field module~m_io_field_utils->module~m_logger module~m_io_field_utils->module~m_solver module~m_io_base m_io_base module~m_io_field_utils->module~m_io_base module~m_nvtx m_nvtx module~m_io_field_utils->module~m_nvtx module~m_io_session->module~m_base_backend module~m_io_session->module~m_common module~m_io_session->module~m_field module~m_io_session->module~m_logger module~m_io_backend~2 m_io_backend module~m_io_session->module~m_io_backend~2 module~m_io_session->module~m_io_base module~m_io_backend~2->m_mpi module~m_io_backend~2->module~m_base_backend module~m_io_backend~2->module~m_common module~m_io_backend~2->module~m_field module~m_io_backend~2->module~m_logger module~m_io_backend~2->iso_c_binding module~m_io_backend~2->iso_fortran_env module~m_io_backend~2->module~m_io_base module~m_io_backend~2->module~m_nvtx adios2 adios2 module~m_io_backend~2->adios2 cudafor cudafor module~m_io_backend~2->cudafor module~m_io_base->module~m_base_backend module~m_io_base->module~m_common module~m_io_base->module~m_field module~m_nvtx->iso_c_binding

Used by

  • module~~m_base_case~~UsedByGraph module~m_base_case m_base_case module~m_case_abl m_case_abl module~m_case_abl->module~m_base_case module~m_case_channel m_case_channel module~m_case_channel->module~m_base_case module~m_case_cylinder m_case_cylinder module~m_case_cylinder->module~m_base_case module~m_case_factory m_case_factory module~m_case_factory->module~m_base_case module~m_case_factory->module~m_case_abl module~m_case_factory->module~m_case_channel module~m_case_factory->module~m_case_cylinder module~m_case_generic m_case_generic module~m_case_factory->module~m_case_generic module~m_case_tgv m_case_tgv module~m_case_factory->module~m_case_tgv module~m_case_wind_turbine m_case_wind_turbine module~m_case_factory->module~m_case_wind_turbine module~m_case_generic->module~m_base_case module~m_case_tgv->module~m_base_case module~m_case_wind_turbine->module~m_base_case module~m_cuda_memcheck_device m_cuda_memcheck_device module~m_cuda_memcheck_device->module~m_base_case module~m_memcheck_build m_memcheck_build module~m_memcheck_build->module~m_base_case module~m_memcheck_build->module~m_case_abl module~m_memcheck_build->module~m_case_factory module~m_memcheck_context m_memcheck_context module~m_memcheck_build->module~m_memcheck_context module~m_memcheck_report m_memcheck_report module~m_memcheck_build->module~m_memcheck_report module~m_memcheck_estimate m_memcheck_estimate module~m_memcheck_build->module~m_memcheck_estimate program~xcompact xcompact program~xcompact->module~m_base_case program~xcompact->module~m_case_factory module~m_memcheck_context->module~m_cuda_memcheck_device module~m_memcheck_report->module~m_cuda_memcheck_device module~m_memcheck_report->module~m_memcheck_context module~m_memcheck_report->module~m_memcheck_estimate program~x3d2_memcheck x3d2_memcheck program~x3d2_memcheck->module~m_memcheck_build program~x3d2_memcheck->module~m_memcheck_context program~x3d2_memcheck->module~m_memcheck_report program~x3d2_memcheck->module~m_memcheck_estimate module~m_memcheck_estimate->module~m_memcheck_context

Abstract Interfaces

abstract interface

  • public subroutine define_BC(self)

    Applies case-specific boundary conditions

    Arguments

    Type IntentOptional Attributes Name
    class(base_case_t) :: self

abstract interface

  • public subroutine initial_conditions(self)

    Sets case-specific initial conditions

    Arguments

    Type IntentOptional Attributes Name
    class(base_case_t) :: self

abstract interface

  • public subroutine forcings(self, du, dv, dw, iter)

    Applies case-specific or model related forcings after transeq

    Arguments

    Type IntentOptional Attributes Name
    class(base_case_t) :: self
    class(field_t), intent(inout) :: du
    class(field_t), intent(inout) :: dv
    class(field_t), intent(inout) :: dw
    integer, intent(in) :: iter

abstract interface

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

    Applies case-specific pre-correction to the velocity fields before pressure correction

    Arguments

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

abstract interface

  • public subroutine postprocess(self, iter, t)

    Triggers case-specific postprocessings at user specified intervals

    Arguments

    Type IntentOptional Attributes Name
    class(base_case_t) :: self
    integer, intent(in) :: iter
    real(kind=dp), intent(in) :: t

Derived Types

type, public, abstract ::  base_case_t

Components

Type Visibility Attributes Name Initial
class(solver_t), public, allocatable :: solver
type(io_manager_t), public :: io_mgr
type(monitoring_t), public :: monitoring
class(field_t), public, pointer :: bc_start_u_x => null()
class(field_t), public, pointer :: bc_start_v_x => null()
class(field_t), public, pointer :: bc_start_w_x => null()
class(field_t), public, pointer :: bc_end_u_x => null()
class(field_t), public, pointer :: bc_end_v_x => null()
class(field_t), public, pointer :: bc_end_w_x => null()
class(field_t), public, pointer :: bc_start_u_y => null()
class(field_t), public, pointer :: bc_start_v_y => null()
class(field_t), public, pointer :: bc_start_w_y => null()
class(field_t), public, pointer :: bc_end_u_y => null()
class(field_t), public, pointer :: bc_end_v_y => null()
class(field_t), public, pointer :: bc_end_w_y => null()

Type-Bound Procedures

procedure(define_BC), public, deferred :: define_BC
procedure(initial_conditions), public, deferred :: initial_conditions
procedure(forcings), public, deferred :: forcings
procedure(apply_BC), public, deferred :: apply_BC
procedure(postprocess), public, deferred :: postprocess
procedure, public :: post_step
procedure, public :: compute_outflow_params
procedure, public :: outflow_flow_rate_correction
procedure, public :: case_init
procedure, public :: case_finalise
procedure, public :: finalise_case_specific => finalise_case_specific_default
procedure, public :: set_init
procedure, public :: substep
procedure, public :: set_curr_fields
procedure, public :: finish_step
procedure, public :: run

Functions

public function outflow_flow_rate_correction(self, u, out_vel, y_weights) result(flow_rate_diff)

The flow_rate_diff for the X_FACE stamp of field_set_face_from_field that makes the flow rate out equal the flow rate in exactly, as the pressure projection sees them. The x staggered derivative sums to (u(nx) - u(1))/dx over the cells, so only the two face planes enter, each weighted over y by y_weights: the case passes the weights of the y interpolation (1/2 on a non-periodic boundary plane, 1 elsewhere), with 0 on any plane it overwrites with the same value on both faces after the stamp. The stamp is linear in u, u(nx) <- (1 - c)u(nx) + cu(nx - 1) + flow_rate_diff, so the sums of the planes before it give the outlet flow rate after it. Call it with u as it is about to be stamped, once bc_start_u_x holds this substep's inlet plane. Assumes x is not decomposed, as compute_outflow_params does.

Arguments

Type IntentOptional Attributes Name
class(base_case_t) :: self
class(field_t), intent(in) :: u
real(kind=dp), intent(in) :: out_vel
real(kind=dp), intent(in) :: y_weights(:)

Return Value real(kind=dp)


Subroutines

public subroutine case_init(self, backend, mesh, host_allocator)

Arguments

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

public subroutine case_finalise(self)

Arguments

Type IntentOptional Attributes Name
class(base_case_t) :: self

public subroutine post_step(self, iter, t)

Called after every completed time step, unlike postprocess which runs only every n_output steps. No-op unless a case overrides it.

Arguments

Type IntentOptional Attributes Name
class(base_case_t) :: self
integer, intent(in) :: iter
real(kind=dp), intent(in) :: t

public subroutine compute_outflow_params(self, out_vel, flow_rate_diff)

Convective outflow number and inlet/outlet flow-rate imbalance for a case with an x inflow and a convective x outflow (the X_FACE form of field_set_face_from_field). Three slice reductions on the device and two batched MPI_Allreduces; no D2H copy of the full field. Assumes x is not decomposed, as the FFT Poisson solver requires. Without flow_rate_diff only the outflow number is computed.

Arguments

Type IntentOptional Attributes Name
class(base_case_t) :: self
real(kind=dp), intent(out) :: out_vel
real(kind=dp), intent(out), optional :: flow_rate_diff

public subroutine finalise_case_specific_default(self)

Arguments

Type IntentOptional Attributes Name
class(base_case_t) :: self

public subroutine set_init(self, field, field_func)

Arguments

Type IntentOptional Attributes Name
class(base_case_t) :: self
class(field_t), intent(inout) :: field
public pure function field_func(coords) result(r)
Arguments
Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: coords(3)
Return Value real(kind=dp)

public subroutine substep(self, curr, deriv, iter)

One time-integrator sub-stage: case-specific BCs, transeq, forcings, time integration, case BC re-application, IBM body force, and pressure correction. Extracted from run()'s per-sub-stage loop body so the same allocation path can be driven directly (e.g. by the memory-estimate probe) without going through the full time loop, I/O cadence, or diagnostics.

Arguments

Type IntentOptional Attributes Name
class(base_case_t), intent(inout) :: self
type(flist_t), intent(inout) :: curr(:)
type(flist_t), intent(inout) :: deriv(:)
integer, intent(in) :: iter

public subroutine set_curr_fields(self, curr, deriv)

Allocates the time integrator field lists and points curr at the solver velocity and species fields. Shared by run() and x3d2-memcheck.

Arguments

Type IntentOptional Attributes Name
class(base_case_t), intent(inout) :: self
type(flist_t), intent(out), allocatable :: curr(:)
type(flist_t), intent(out), allocatable :: deriv(:)

public subroutine finish_step(self, iter, output_vorticity, output_qcriterion)

The per-iteration work after the substeps: sets current_iter and computes the pressure and the derived fields. Shared by run() and x3d2-memcheck.

Arguments

Type IntentOptional Attributes Name
class(base_case_t), intent(inout) :: self
integer, intent(in) :: iter
logical, intent(in) :: output_vorticity
logical, intent(in) :: output_qcriterion

public subroutine run(self)

Runs the solver forwards in time from t=t_0 to t=T, performing postprocessing/IO and reporting diagnostics.

Arguments

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