Skip to content

adam_prism_fnl_object

ADAM, PRISM (Plasma Research usIng Simulation Methods) equations system class definition, GPU (FNL) backend.

Source: src/app/prism/fnl/adam_prism_fnl_object.F90

Dependencies

Contents

Derived Types

prism_fnl_object

PRISM equations system class definition, GPU (FNL) backend.

Inheritance

Extends: prism_common_object

Components

NameTypeAttributesDescription
iotype(io_object)IO handler.
amrtype(amr_object)AMR marker handler.
slicestype(slices_object)Slices handler.
blanesmoantype(blanesmoan_object)Blanes-Moan integrator.
cfmtype(cfm_object)Commutator-Free Magnus integrator.
leapfrogtype(leapfrog_object)Leapfrog integrator.
flailtype(flail_object)Linear algebra methods handler.
wenotype(weno_object)WENO reconstructor.
ibtype(ib_object)Immersed boundary.
rktype(rk_object)Runge-Kutta integrator.
adamtype(adam_object)ADAM, grid + tree + field + maps orchestrator.
fdv_schemecharacter(len=:)allocatableFDV scheme, fd/fv.
fdv_orderinteger(kind=I4P)Order of finite difference/volume schemes, general order.
fdv_half_stencilinteger(kind=I4P)Half stencil length of finite difference/volume schemes.
fdv_half_stencilsinteger(kind=I4P)Half stencil length of fdv schemes for each derivative up to 6.
ngcinteger(kind=I4P)pointerNumber of ghost cells.
niinteger(kind=I4P)pointerNumber of cells in i direction.
njinteger(kind=I4P)pointerNumber of cells in j direction.
nkinteger(kind=I4P)pointerNumber of cells in k direction.
nbinteger(kind=I4P)pointerTotal blocks number for MPI.
blocks_numberinteger(kind=I4P)pointerActual blocks number.
nvinteger(kind=I4P)pointerNumber of variables in q vector.
realm_indexinteger(kind=I4P)Inter-realm seam coupling — currently-published stage buffer key.
stage_activeinteger(kind=I4P)Procedure pointer TBPs for FDV operators (set at initialization by backend).
compute_block_total_variationprocedure(compute_block_total_variation_interface)pass(self), pointerCompute TV.
compute_curlprocedure(compute_curl_interface)pass(self), pointerCompute curl.
compute_derivative1procedure(compute_derivative1_interface)pass(self), pointerCompute deriv1.
compute_derivative2procedure(compute_derivative2_interface)pass(self), pointerCompute deriv2.
compute_derivative4procedure(compute_derivative4_interface)pass(self), pointerCompute deriv4.
compute_divergenceprocedure(compute_divergence_interface)pass(self), pointerCompute dive.
compute_gradientprocedure(compute_gradient_interface)pass(self), pointerCompute grad.
compute_laplacianprocedure(compute_laplacian_interface)pass(self), pointerCompute laplac.
nv_cinteger(kind=I4P)pointerNumber of conservative variables in q vector.
nv_sinteger(kind=I4P)pointerNumber of source variables in q vector.
nv_clinteger(kind=I4P)pointerNumber of divergence cleaning variables in q vector.
qreal(kind=R8P)allocatableConservative cell centered variables.
dqreal(kind=R8P)allocatableResiduals right hand side.
q_picreal(kind=R8P)allocatablePIC variables.
pic_fieldsreal(kind=R8P)allocatableFields value at particle locations.
curlreal(kind=R8P)allocatableCurl fields.
divergencereal(kind=R8P)allocatableDivergence fields.
q_nametype(string)allocatableFields names [1:nv].
dq_nametype(string)allocatableResiduals names [1:nv].
q_pic_nametype(string)allocatablePIC Fields names.
curl_nametype(string)allocatableCurl fields names.
div_nametype(string)allocatableDivergence fields names.
energy_Dreal(kind=R8P)allocatableEnergy of field D, time history.
energy_Breal(kind=R8P)allocatableEnergy of field B, time history.
coil_powerreal(kind=R8P)allocatablePower of coils, time history.
Poynting_fluxreal(kind=R8P)allocatableTotal Poynting flux from boundary, time history.
rms_energy_error_Dreal(kind=R8P)RMS energy error of D field.
rms_energy_error_Breal(kind=R8P)RMS energy error of B field.
max_divergence_Dreal(kind=R8P)Maximum of divergence of D field.
max_divergence_Breal(kind=R8P)Maximum of divergence of B field.
max_divergence_Jreal(kind=R8P)Maximum of divergence of J field.
bctype(prism_bc_object)Boundary conditions.
coiltype(prism_coil_object)Coil source term.
external_fieldstype(prism_external_fields_object)External fields.
fWLayertype(prism_fWLayer_object)Far-field weighted layer.
ictype(prism_ic_object)Initial conditions.
leapfrog_pictype(prism_leapfrog_pic_object)Leapfrog PIC integrator.
numericstype(prism_numerics_object)Numerics configuration.
particle_injectiontype(prism_particle_injection_object)Particle injection.
physicstype(prism_physics_object)Physics configuration.
pictype(prism_pic_object)PIC state.
rk_bctype(prism_rk_bc_object)Runge-Kutta BC handler.
rk_pictype(prism_rk_pic_object)Runge-Kutta PIC handler.
timetype(prism_time_object)Time integration state.
field_fnltype(field_fnl_object)GPU field handler.
ib_fnltype(ib_fnl_object)GPU immersed boundary.
rk_fnltype(rk_fnl_object)GPU Runge-Kutta integrator.
weno_fnltype(weno_fnl_object)GPU WENO reconstructor.
coil_fnltype(prism_fnl_coil_object)GPU coil source.
fwlayer_fnltype(prism_fnl_fwlayer_object)GPU fWLayer.
q_gpureal(kind=R8P)pointerField cell centered variables.
dq_gpureal(kind=R8P)pointerResiduals right hand side.
flxyz_c_gpureal(kind=R8P)pointerFluxes at cell center with +/- decomposition for all directions.
flx_f_gpureal(kind=R8P)pointerFluxes along x at cell face.
fly_f_gpureal(kind=R8P)pointerFluxes along y at cell face.
flz_f_gpureal(kind=R8P)pointerFluxes along z at cell face.
curl_gpureal(kind=R8P)pointerCurl fields.
divergence_gpureal(kind=R8P)pointerDivergence fields.
db5integer(kind=I4P)Device data bounds (rank 5): bb(1,:)=lower, bb(2,:)=upper.
hb5integer(kind=I4P)Host buffer data bounds (rank 5): bb(1,:)=lower, bb(2,:)=upper.
buf_5D_R8Preal(kind=R8P)allocatableBuffer (host memory, device shape), rank 5, R8P.
compute_curl_devprocedure(compute_curl_interface_dev)pass(self), pointerCompute curl.
compute_derivative1_devprocedure(compute_derivative1_interface_dev)pass(self), pointerCompute derivative1.
compute_derivative2_devprocedure(compute_derivative2_interface_dev)pass(self), pointerCompute derivative2.
compute_derivative4_devprocedure(compute_derivative4_interface_dev)pass(self), pointerCompute derivative4.
compute_divergence_devprocedure(compute_divergence_interface_dev)pass(self), pointerCompute divergence.
compute_gradient_devprocedure(compute_gradient_interface_dev)pass(self), pointerCompute gradient.
compute_laplacian_devprocedure(compute_laplacian_interface_dev)pass(self), pointerCompute laplacian.
compute_residuals_devprocedure(compute_residuals_interface_dev)pass(self), pointerCompute residuals.
integrate_devprocedure(integrate_interface_dev)pass(self), pointerIntegrate, time operator.

Type-Bound Procedures

NameAttributesDescription
load_fdv_from_filepass(self)Load FDV config from file.
close_block_xh5fnopassClose XH5F file block.
close_file_xh5fnopassClose XH5F file.
open_block_xh5fpass(self)Open block file XH5F.
open_file_xh5fpass(self)Open file XH5F.
save_q_xh5fpass(self)Save in XH5F (XDMF/HDF5) format.
allocate_commonpass(self)Allocate common data.
compute_auxiliary_fieldspass(self)Compute auxiliary fields.
initializepass(self)Initialize the equation common data.
save_energy_errorpass(self)Save energy error history.
save_energy_historypass(self)Save energy history.
save_divergence_historypass(self)Save divergence history.
save_restart_filespass(self)Save restart files.
save_xh5fpass(self)Save simulation data in XH5F format.
initialize_coilspass(self)Initialize coils.
set_rectangular_coil_xpass(self)Subroutine to set a rectangular coil source with +-x normal
set_rectangular_coil_ypass(self)Subroutine to set a rectangular coil source with +-y normal
set_rectangular_coil_zpass(self)Subroutine to set a rectangular coil source with +-z normal
set_circular_coil_xpass(self)Subroutine to set a circular coil source with +-x normal
set_circular_coil_ypass(self)Subroutine to set a circular coil source with +-y normal
set_circular_coil_zpass(self)Subroutine to set a circular coil source with +-z normal
set_solenoid_xpass(self)Subroutine to set a solenoid source with +-x normal
set_solenoid_ypass(self)Subroutine to set a solenoid source with +-y normal
set_solenoid_zpass(self)Subroutine to set a solenoid source with +-z normal
set_helicon_coilpass(self)Subroutine to set a helicon coil source.
coupling_descriptor_forestpass(self)Report (scheme_time, rk_scheme, nv) for β admissibility.
allocate_gpupass(self)Allocate GPU data.
copy_cpu_gpupass(self)Copy data from CPU to GPU.
copy_gpu_cpupass(self)Copy data from GPU to CPU.
initialize_prismpass(self)Initialize PRISM equation.
load_restart_filespass(self)Load restart files.
save_residualspass(self)Save residuals history.
save_simulation_datapass(self)Save all simulation data.
apply_fwl_correctionpass(self)Apply fWLayer correction (if present)
compute_coils_currentpass(self)Compute current coils sources.
set_boundary_conditionspass(self)Set boundary conditions of equation.
set_initial_conditionspass(self)Set initial conditions of equation.
update_ghostpass(self)Update ghost cells and set boundary conditions.
update_rk_ghostpass(self)Update RK stage ghost cells.
compute_curl_fd_devpass(self)Compute curl of vector field by finite difference.
compute_curl_fv_devpass(self)Compute curl of vector field by finite volume.
compute_derivative1_fd_devpass(self)Compute derivative1 of scalar fields, finite difference schemes.
compute_derivative1_fv_devpass(self)Compute derivative1 of scalar fields, finite volume schemes.
compute_derivative2_fd_devpass(self)Compute derivative2 of scalar fields, finite difference schemes.
compute_derivative2_fv_devpass(self)Compute derivative2 of scalar fields, finite volume schemes.
compute_derivative4_fd_devpass(self)Compute derivative4 of scalar fields, finite difference schemes.
compute_divergence_fd_devpass(self)Compute divergence of vector field by finite difference.
compute_divergence_fv_devpass(self)Compute divergence of vector field by finite volume.
compute_gradient_fd_devpass(self)Compute gradient of scalar field, finite difference schemes.
compute_gradient_fv_devpass(self)Compute gradient of scalar field, finite volume schemes.
compute_laplacian_fd_devpass(self)Compute laplacian of scalar field, finite difference schemes.
compute_laplacian_fv_devpass(self)Compute laplacian of scalar field, finite volume schemes.
compute_residuals_fd_centered_devpass(self)Compute residuals, centered finite difference schemes.
integrate_blanesmoan_devpass(self)Blanes and Moan scheme.
integrate_cfm_devpass(self)Commutator-Free Magnus scheme.
integrate_leapfrog_devpass(self)Leapfrog scheme.
integrate_rk_ls_devpass(self)RK classical low storage schemes.
integrate_rk_ssp_devpass(self)SSP RK schemes.
integrate_rk_yoshida_devpass(self)Yoshida schemes.
initialize_forestpass(self)Invoked by forest%initialize per realm at startup.
compute_local_dt_forestpass(self)Invoked by forest%compute_global_dt during the min reduction.
advance_one_step_forestpass(self)Invoked by forest%evolve_one_step per realm per timestep.
stages_per_step_forestpass(self)Number of integrator stages this realm exposes per step.
open_step_forestpass(self)Per-step prologue (multi-realm path).
begin_stage_forestpass(self)Begin one integrator stage on this realm (multi-realm path).
end_stage_forestpass(self)End the stage: residuals + assignment (multi-realm path).
close_step_forestpass(self)Per-step epilogue (multi-realm path).
post_step_forestpass(self)Invoked by forest%post_step per realm per timestep.
is_done_forestpass(self)Invoked by forest%is_done during the termination reduction.
finalize_forestpass(self)Invoked by forest%finalize per realm at shutdown.
finalize_mpi_forestpass(self)Process-global MPI finalize (mpih_fnl).
fill_seam_from_peer_forestpass(self)OpenACC device-direct copy of peer's GPU interior into self's GPU ghosts.
after_topology_build_forestpass(self)Refresh device-resident seam maps from freshly-built host maps.
apply_reflux_to_stage_forestpass(self)Apply Berger-Colella reflux to self's RK stage buffer (FNL no-op).
compute_dtpass(self)Compute time step.
compute_energypass(self)Compute energy.
compute_energy_errorpass(self)Compute energy error.
compute_max_divergencepass(self)Compute divergence of D, B and J fields for diagnostics.
impose_ct_correctionpass(self)Impose Constrained Transport correction on q(ivar:ivar+2).
impose_div_freepass(self)Impose divergence-free property.
simulatepass(self)Perform the simulation.

Interfaces

compute_curl_interface_dev

compute_derivative1_interface_dev

compute_derivative2_interface_dev

compute_derivative4_interface_dev

compute_divergence_interface_dev

compute_gradient_interface_dev

compute_laplacian_interface_dev

compute_residuals_interface_dev

integrate_interface_dev

Subroutines

allocate_gpu

Allocate GPU data.

fortran
subroutine allocate_gpu(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

copy_cpu_gpu

Copy data from CPU to GPU.

fortran
subroutine copy_cpu_gpu(self, verbose)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
verboselogicalinoptionalTrigger verbose output.

Call graph

copy_gpu_cpu

Copy data from GPU to CPU.

fortran
subroutine copy_gpu_cpu(self, compute_copy_q_aux, copy_phi, verbose)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
compute_copy_q_auxlogicalinoptionalFlag to compute auxiliary variables.
copy_philogicalinoptionalCopy also phi.
verboselogicalinoptionalTrigger verbose output.

Call graph

initialize_prism

Initialize PRISM equation.

fortran
subroutine initialize_prism(self, filename, realms_number)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inouttargetThe equation.
filenamecharacter(len=*)inInput file name.
realms_numberinteger(kind=I4P)inoptionalForest realm count; divides the per-device budget

Call graph

load_restart_files

Save restart files.

fortran
subroutine load_restart_files(self, t, time)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
tinteger(kind=I4P)outTime iteration.
timereal(kind=R8P)outTime.

Call graph

save_residuals

Save residuals history.

fortran
subroutine save_residuals(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

save_simulation_data

Save all simulation data.

fortran
subroutine save_simulation_data(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

apply_fwl_correction

Apply correction if a fWL is present.

fortran
subroutine apply_fwl_correction(self, q_gpu)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
q_gpureal(kind=R8P)inoutConservative variables.

Call graph

compute_coils_current

Compute current coils sources.

fortran
subroutine compute_coils_current(self, q_gpu, gamm)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe equation.
q_gpureal(kind=R8P)inoutConservative variables.
gammreal(kind=R8P)inoptionalRK coefficient.

Call graph

set_boundary_conditions

Set boundary conditions of equation.

fortran
subroutine set_boundary_conditions(self, q_gpu)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe equation.
q_gpureal(kind=R8P)inoutConservative variables.

Call graph

set_initial_conditions

Set initial conditions of field.

fortran
subroutine set_initial_conditions(self, is_restart)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
is_restartlogicalinBranching sentinel for restart/non restart path.

Call graph

update_ghost

Update ghost cells (intra-realm only).

Inter-realm seam ghost cells are filled by the forest's Phase 2 seam exchange (between assemble and evaluate) via fill_seam_from_peer_forest, NOT here. The legacy realm(:) optional dummy and the exchange_inter_realm_halos_forest call have been retired by the agnostic-dummy seam redesign.

fortran
subroutine update_ghost(self, q_gpu, step, s)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
q_gpureal(kind=R8P)inoutConservative variables.
stepinteger(kind=I4P)inoptionalStep to be performed in async comp.
sinteger(kind=I4P)inoptionalStage counter.

Call graph

update_rk_ghost

Update RK ghost cells.

fortran
subroutine update_rk_ghost(self, dt, phi_gpu)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutRK object.
dtreal(kind=R8P)inCurrent time step.
phi_gpureal(kind=R8P)inoptionalIB distance.

compute_curl_fd_dev

Compute curl of vector fields, div(q(ivar:ivar+2), using finite difference schemes.

fortran
subroutine compute_curl_fd_dev(self, ivar, q_gpu, curl_gpu)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe equation.
ivarinteger(kind=I4P)inStart index of variable of q.
q_gpureal(kind=R8P)inField variables.
curl_gpureal(kind=R8P)inoutCurl.

Call graph

compute_curl_fv_dev

Compute curl of vector fields, div(q(ivar:ivar+2), using finite volume schemes.

fortran
subroutine compute_curl_fv_dev(self, ivar, q_gpu, curl_gpu)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe equation.
ivarinteger(kind=I4P)inStart index of variable of q.
q_gpureal(kind=R8P)inField variables.
curl_gpureal(kind=R8P)inoutCurl.

compute_derivative1_fd_dev

Compute derivative1 of scalar fields, dq(ivar)/ds, using finite difference schemes.

fortran
subroutine compute_derivative1_fd_dev(self, dir, ivar, q_gpu, dq_ds_gpu)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe equation.
dirinteger(kind=I4P)inDirection, 1=X, 2=Y, 3=Z.
ivarinteger(kind=I4P)inStart index of variable of q.
q_gpureal(kind=R8P)inField variables.
dq_ds_gpureal(kind=R8P)inoutDerivative1, dq/ds.

compute_derivative1_fv_dev

Compute derivative1 of scalar fields, dq(ivar)/ds, using finite volume schemes.

fortran
subroutine compute_derivative1_fv_dev(self, dir, ivar, q_gpu, dq_ds_gpu)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe equation.
dirinteger(kind=I4P)inDirection, 1=X, 2=Y, 3=Z.
ivarinteger(kind=I4P)inStart index of variable of q.
q_gpureal(kind=R8P)inField variables.
dq_ds_gpureal(kind=R8P)inoutDerivative1, dq/ds.

compute_derivative2_fd_dev

Compute derivative2 of scalar fields, d2q(ivar)/ds2, using finite difference schemes.

fortran
subroutine compute_derivative2_fd_dev(self, dir, ivar, q_gpu, d2q_ds2_gpu)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe equation.
dirinteger(kind=I4P)inDirection, 1=X, 2=Y, 3=Z.
ivarinteger(kind=I4P)inStart index of variable of q.
q_gpureal(kind=R8P)inField variables.
d2q_ds2_gpureal(kind=R8P)inoutDerivative2, d2q/ds2.

compute_derivative2_fv_dev

Compute derivative2 of scalar fields, d2q(ivar)/ds2, using finite volume schemes.

fortran
subroutine compute_derivative2_fv_dev(self, dir, ivar, q_gpu, d2q_ds2_gpu)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe equation.
dirinteger(kind=I4P)inDirection, 1=X, 2=Y, 3=Z.
ivarinteger(kind=I4P)inStart index of variable of q.
q_gpureal(kind=R8P)inField variables.
d2q_ds2_gpureal(kind=R8P)inoutDerivative2, d2q/ds2.

compute_derivative4_fd_dev

Compute derivative4 of scalar fields, d4q(ivar)/ds4, using finite difference schemes.

fortran
subroutine compute_derivative4_fd_dev(self, dir, ivar, q_gpu, d4q_ds4_gpu)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe equation.
dirinteger(kind=I4P)inDirection, 1=X, 2=Y, 3=Z.
ivarinteger(kind=I4P)inStart index of variable of q.
q_gpureal(kind=R8P)inField variables.
d4q_ds4_gpureal(kind=R8P)inoutDerivative4, d4q/ds4.

compute_divergence_fd_dev

Compute divergence of vector fields, div(q(ivar:ivar+2), using finite difference schemes. Directly computes divergence from transposed GPU layout (b,i,j,k,v).

fortran
subroutine compute_divergence_fd_dev(self, ivar, ovar, q_gpu, divergence_gpu, maxdiv)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe equation.
ivarinteger(kind=I4P)inStart index of
ovarinteger(kind=I4P)inOutput index in
q_gpureal(kind=R8P)inField variables.
divergence_gpureal(kind=R8P)inoutDivergence.
maxdivreal(kind=R8P)outoptionalMax divergence,

Call graph

compute_divergence_fv_dev

Compute divergence of vector fields, div(q(ivar:ivar+2), using finite volume schemes. Directly computes divergence from transposed GPU layout (b,i,j,k,v).

fortran
subroutine compute_divergence_fv_dev(self, ivar, ovar, q_gpu, divergence_gpu, maxdiv)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe equation.
ivarinteger(kind=I4P)inStart index of
ovarinteger(kind=I4P)inOutput index in
q_gpureal(kind=R8P)inField variables.
divergence_gpureal(kind=R8P)inoutDivergence.
maxdivreal(kind=R8P)outoptionalMax divergence,

compute_gradient_fd_dev

Compute gradient of scalar variable q(ivar), finite difference schemes.

fortran
subroutine compute_gradient_fd_dev(self, ivar, q_gpu, gradient_gpu)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe equation.
ivarinteger(kind=I4P)inIndex of scalar var of q.
q_gpureal(kind=R8P)inField variables.
gradient_gpureal(kind=R8P)inoutGradient.

compute_gradient_fv_dev

Compute gradient of scalar variable q(ivar), finite volume schemes.

fortran
subroutine compute_gradient_fv_dev(self, ivar, q_gpu, gradient_gpu)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe equation.
ivarinteger(kind=I4P)inIndex of scalar var of q.
q_gpureal(kind=R8P)inField variables.
gradient_gpureal(kind=R8P)inoutGradient.

compute_laplacian_fd_dev

Compute laplacian of scalar variable q(ivar), finite difference schemes.

fortran
subroutine compute_laplacian_fd_dev(self, ivar, q_gpu, laplacian_gpu)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe equation.
ivarinteger(kind=I4P)inIndex of scalar variable of q.
q_gpureal(kind=R8P)inField variables.
laplacian_gpureal(kind=R8P)inoutGradient.

compute_laplacian_fv_dev

Compute laplacian of scalar variable q(ivar), finite volume schemes.

fortran
subroutine compute_laplacian_fv_dev(self, ivar, q_gpu, laplacian_gpu)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe equation.
ivarinteger(kind=I4P)inIndex of scalar variable of q.
q_gpureal(kind=R8P)inField variables.
laplacian_gpureal(kind=R8P)inoutGradient.

compute_residuals_fd_centered_dev

Compute residuals of equation, space operator, centered finite difference schemes.

fortran
subroutine compute_residuals_fd_centered_dev(self, q_gpu, dq_gpu, s)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
q_gpureal(kind=R8P)inoutConservative variables.
dq_gpureal(kind=R8P)inoutResiduals.
sinteger(kind=I4P)inoptionalStage counter.

Call graph

integrate_blanesmoan_dev

Integrate equation, time operator, Blanes and Moan scheme.

fortran
subroutine integrate_blanesmoan_dev(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

integrate_cfm_dev

Integrate equation, time operator, Commutator-Free Magnus integrator.

fortran
subroutine integrate_cfm_dev(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

integrate_leapfrog_dev

Integrate equation, time operator, leapfrog scheme.

fortran
subroutine integrate_leapfrog_dev(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

integrate_leapfrog_pic

Integrate equation, time operator, leapfrog scheme.

fortran
subroutine integrate_leapfrog_pic(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

integrate_rk_ls_dev

Integrate equation, time operator, RK classical low storage schemes. Low storage RK working on q_rk(:,:,:,:,:,1)/q as stages, update q in place.

fortran
subroutine integrate_rk_ls_dev(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

integrate_rk_ssp_dev

Integrate equation, time operator, SSP RK schemes. SSP RK working on q_rk as stages.

fortran
subroutine integrate_rk_ssp_dev(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

integrate_rk_yoshida_dev

Integrate equation, time operator, Yoshida RK scheme.

fortran
subroutine integrate_rk_yoshida_dev(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

is_done_forest

Decide whether this realm has reached its local termination criterion.

Invoked by forest%is_done. PRISM-FNL override: matches the legacy condition inline in simulate — terminate when either the simulated time has reached self%time%time_max (time-driven mode, it_max <= 0) or the iteration count has reached self%time%it_max (iteration-driven mode). Today the test reads time-state from the time module singleton, so self is unused; once the forest takes over time bookkeeping the body will consume self%time%* instead.

fortran
subroutine is_done_forest(self, done)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe realm.
donelogicaloutTrue if this realm is done evolving.

Call graph

finalize_forest

Shut this realm down: final state dump, close residuals file, finalize MPI handler.

fortran
subroutine finalize_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe realm.

Call graph

finalize_mpi_forest

Finalize the process-global FNL MPI handler (mpih_fnl).

Overrides realm_object%finalize_mpi_forest to target the FNL mpih_fnl singleton instead of the CPU mpih. Called ONCE by forest%finalize after every realm's finalize_forest (see the base for the rationale).

fortran
subroutine finalize_mpi_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe realm (carries no MPI state).

Call graph

simulate

Perform the simulation: legacy single-realm entry point.

fortran
subroutine simulate(self, filename)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
filenamecharacter(len=*)inInput file name.

Call graph

initialize_forest

Initialize this realm from scratch: PRISM init, IC injection (or restart load), initial ghost update, initial diagnostics dump, IO files open, plus PIC/leapfrog priming if those schemes are active.

Invoked by forest%initialize. The forest writes self%realm_index = is BEFORE calling this routine, so the body can already read the 1-based forest position from self%realm_index if needed.

fortran
subroutine initialize_forest(self, filename, realms_number, memory_avail, nv, verbose)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe realm.
filenamecharacter(len=*)inInput parameters file name.
realms_numberinteger(kind=I4P)inoptionalRealm count; divides the per-device budget.
memory_availreal(kind=R8P)inoptionalPer-process memory budget override.
nvinteger(kind=I4P)inoptionalNumber of field variables override.
verboselogicalinoptionalTrigger verbose output.

Call graph

compute_local_dt_forest

Compute this realm's local stability-limited dt (no MPI reduction).

Invoked by forest%compute_global_dt during the min reduction across all realms in the forest. The reduction itself is the orchestrator's job; this method computes only the value local to self. Compute this realm's local stability-limited dt (no MPI reduction).

fortran
subroutine compute_local_dt_forest(self, dt_local)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe realm.
dt_localreal(kind=R8P)outLocal stability-limited dt.

Call graph

advance_one_step_forest

Advance this realm by one full timestep of size dt.

Invoked by forest%evolve_one_step once per realm per timestep. Owns the integration itself, i.e. everything that turns q at time t into q at time t + dt.

fortran
subroutine advance_one_step_forest(self, dt)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe realm.
dtreal(kind=R8P)inTimestep size from the forest's global reduction.

Call graph

open_step_forest

Per-step prologue on the multi-realm path: set dt, init RK stages.

Mirrors the head of integrate_rk_ssp: external-field prelude (if active), rk%initialize_stages(q=self%q), and the per-step time bookkeeping advance_one_step_forest does inline (it increment, dt cap for time_max, self%time%dt update). Time advance and progress print run in close_step_forest, mirroring the legacy ordering.

fortran
subroutine open_step_forest(self, dt)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe realm.
dtreal(kind=R8P)inTimestep size from the forest.

Call graph

begin_stage_forest

Begin integrator stage k on the multi-realm path (FNL).

Mirrors the FIRST line of integrate_rk_ssp's substage body: rk_fnl%compute_stage(s=k, dt=self%time%dt [, phi_gpu=ib_fnl%phi_gpu]). This populates rk_fnl%q_rk_gpu(:,:,:,:,:,k) from previously computed substages and from self%q_gpu, and publishes the stage buffer to peers by setting self%stage_active = k. No ghost reads, no peer-realm access — peer realms may not yet have opened their stage-k buffer when this fires.

fortran
subroutine begin_stage_forest(self, k, K_total, dt, realm)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe realm.
kinteger(kind=I4P)inStage index (1..K_total).
K_totalinteger(kind=I4P)inForest-wide stage count for this step.
dtreal(kind=R8P)inTimestep size from the forest.
realmclass(realm_object)inouttarget, optionalSibling realms (contract parity).

Call graph

end_stage_forest

Close integrator stage k: residuals + stage assignment in one sweep (FNL).

This is the FNL forest's Phase 3 TBP. Inter-realm seam ghost cells on rk_fnl%q_rk_gpu(:,...,k) are already filled by Phase 2 (which called fill_seam_from_peer_forest on this realm and its peers), so compute_residuals_dev reads valid halo data and rk_fnl%assign_stage's in-place overwrite of the stage interior no longer races with peer reads.

realm accepted on contract for parity but unused: the seam has already been refreshed by the forest. Reflux for FV is not yet implemented on the FNL side (the FV residual path is commented out; compute_residuals_fv_centered_dev is a follow-up port).

fortran
subroutine end_stage_forest(self, k, K_total, dt, realm, flux_register)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe realm.
kinteger(kind=I4P)inStage index (1..K_total).
K_totalinteger(kind=I4P)inForest-wide stage count for this step.
dtreal(kind=R8P)inTimestep size from the forest.
realmclass(realm_object)inouttarget, optionalSibling realms (FNL parity only; unused).
flux_registerclass(flux_register_object)inoutoptionalForest's flux register for FV reflux.

Call graph

close_step_forest

Per-step epilogue on the multi-realm path: q assembly, BC, div-clean, residual save, coil source refresh, time advance, progress print (FNL).

fortran
subroutine close_step_forest(self, dt)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe realm.
dtreal(kind=R8P)inTimestep size from the forest.

Call graph

fill_seam_from_peer_forest

FNL twin of prism_cpu_object%fill_seam_from_peer_forest. Walks the host-side row-range bookkeeping (seam_local_peer_row_start/count, populated by build_seam_local_map on the host), then dispatches an OpenACC kernel that reads peer's GPU buffer at peer-INTERIOR coords (FNL layout (b,i,j,k,v)) and writes self's GPU buffer at recv-side coords.

fortran
subroutine fill_seam_from_peer_forest(self, peer, p_idx)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inout
peerclass(realm_object)intarget
p_idxinteger(kind=I4P)in

Call graph

after_topology_build_forest

Propagate the freshly-built host seam maps and per-peer buffers to device-resident counterparts on field_fnl%maps. Invoked by the forest at the end of populate_inter_realm_topology AFTER build_seam_local_map has populated self%adam%maps%seam_local_*.

fortran
subroutine after_topology_build_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inout

Call graph

apply_reflux_to_stage_forest

PRISM-FNL override of the Berger-Colella reflux correction TBP.

FV reflux is not yet implemented on the FNL side — the FNL FV residual path (compute_residuals_fv_centered_dev) is a follow-up port and currently does NOT accumulate fluxes into the register. The override is therefore a deliberate no-op: with an empty flux register on the FNL side (or with nfaces == 0 for a single-realm FNL forest), there is nothing to correct.

α.r1 cadence (forward-consistency gate): the body returns immediately for stage /= self%rk%nrk. Under the current no-op body this is observationally identical to the previous unconditional return, but it expresses the α.r1 contract explicitly: when the FNL FV residual path is ported, the body grows into the OpenACC twin of prism_cpu_object%apply_reflux_to_stage_forest — walk flux_register%face(:) for entries where coarse_realm == self%realm_index and write the per-cell correction into self%rk_fnl%q_rk_gpu(:, b, i, j, k, stage) under a !$acc parallel loop — and that twin must fire exactly once per realm per step at the realm's final RK substage, reading the register's collapsed third-axis (:,:,1) bucket.

fortran
subroutine apply_reflux_to_stage_forest(self, stage, dt, flux_register)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe realm.
stageinteger(kind=I4P)inIntegrator stage 1..K_total.
dtreal(kind=R8P)inTime step.
flux_registerclass(flux_register_object)inForest's flux register.

Call graph

post_step_forest

Run PRISM-FNL's per-timestep post-step work: state IO, energy diagnostics, max-divergence diagnostics.

Invoked by forest%post_step. v1 implementation is the verbatim post- step block formerly inline in simulate — every action runs every step, since today's cadence is enforced inside the save_* routines themselves (e.g. save_simulation_data honours io%it_save). The do_* flags are signature-only for now: when the forest takes over cadence the flags will gate the individual calls. For now they are accepted but unused, preserving present-day behavior bit-for-bit.

dt, t, it are not consumed by the current body; they are on the contract so the forest can supply them once it owns time-state (today they are still read from the time module singleton).

Optional realm(:): forwarded to save_simulation_data and update_ghost for the dummy-argument inter-realm halo refresh path.

fortran
subroutine post_step_forest(self, dt, t, it, do_save_state, do_save_residuals, do_save_restart, do_amr, realm)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe realm.
dtreal(kind=R8P)inTimestep size just advanced.
treal(kind=R8P)inSimulation time after the advance.
itinteger(kind=I4P)inIteration index after the advance.
do_save_statelogicalinoptionalSave state output this step.
do_save_residualslogicalinoptionalSave residuals output this step.
do_save_restartlogicalinoptionalSave restart dump this step.
do_amrlogicalinoptionalRun AMR update this step.
realmclass(realm_object)inouttarget, optionalSibling realms for inter-realm halo refresh.

Call graph

compute_dt

Compute the global stability-limited dt and store it on self%time%dt.

Body delegates the local computation to compute_local_dt_forest (orchestrator contract method), then performs the legacy MPI_ALLREDUCE on MPI_COMM_WORLD for backward compatibility with simulate. The forest's compute_global_dt performs its own reduction, possibly on a per-realm sub-comm; the redundancy disappears once the legacy compute_dt is retired.

fortran
subroutine compute_dt(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

compute_energy

Compute energy.

fortran
subroutine compute_energy(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

compute_energy_error

Compute energy error.

fortran
subroutine compute_energy_error(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

compute_max_divergence

Compute maximum divergence.

fortran
subroutine compute_max_divergence(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

impose_ct_correction

Impose Constrained Transport Correction on vectorial variable q(ivar:ivar+2). Note that self%divergence memory is used as buffer, be carefull.

fortran
subroutine impose_ct_correction(self, ivar)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
ivarinteger(kind=I4P)inVariable (start) index in q.

Call graph

impose_div_free

Impose divergence-free property.

fortran
subroutine impose_div_free(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

Functions

stages_per_step_forest

Number of integrator stages this realm exposes per step (FNL).

For the multi-realm path the forest drives the stage loop, so it needs to know K up front. Currently only runge-kutta-ssp-* is split into per-stage TBPs (begin_stage_forest / end_stage_forest); for RK realms K = rk%nrk. Other integrators (Yoshida, Leapfrog, Blanes-Moan, CFM) will error-stop on the multi-realm path until they are split as well.

Returns: integer(kind=I4P)

fortran
function stages_per_step_forest(self) result(K)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe realm.

Call graph