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 ​

Variables ​

NameTypeAttributesDescription
FV_FLUX_VARIANT_MAXWELLinteger(kind=I4P)parameterPlain dimensional Maxwell fluxes.
FV_FLUX_VARIANT_MAXWELL_ADIMinteger(kind=I4P)parameterPlain adimensional Maxwell fluxes.
FV_FLUX_VARIANT_MAXWELL_DIV_Dinteger(kind=I4P)parameterDimensional hyperbolic fluxes with D cleaning.
FV_FLUX_VARIANT_MAXWELL_DIV_Binteger(kind=I4P)parameterDimensional hyperbolic fluxes with B cleaning.
FV_FLUX_VARIANT_MAXWELL_DIV_D_Binteger(kind=I4P)parameterDimensional hyperbolic fluxes with D/B cleaning.
FV_FLUX_VARIANT_MAXWELL_ADIM_DIV_Dinteger(kind=I4P)parameterAdimensional hyperbolic fluxes with D cleaning.
FV_FLUX_VARIANT_MAXWELL_ADIM_DIV_Binteger(kind=I4P)parameterAdimensional hyperbolic fluxes with B cleaning.
FV_FLUX_VARIANT_MAXWELL_ADIM_DIV_D_Binteger(kind=I4P)parameterAdimensional hyperbolic fluxes with D/B cleaning.
FD_RESIDUAL_VARIANT_PLAINinteger(kind=I4P)parameterCentered-FD Maxwell residual without hyperbolic cleaning.
FD_RESIDUAL_VARIANT_PHIinteger(kind=I4P)parameterCentered-FD Maxwell residual with phi cleaning only.
FD_RESIDUAL_VARIANT_PSIinteger(kind=I4P)parameterCentered-FD Maxwell residual with psi cleaning only.
FD_RESIDUAL_VARIANT_PHI_PSIinteger(kind=I4P)parameterCentered-FD Maxwell residual with phi/psi cleaning.
PML_FACE_X_Minteger(kind=I4P)parameter
PML_FACE_X_Pinteger(kind=I4P)parameter
PML_FACE_Y_Minteger(kind=I4P)parameter
PML_FACE_Y_Pinteger(kind=I4P)parameter
PML_FACE_Z_Minteger(kind=I4P)parameter
PML_FACE_Z_Pinteger(kind=I4P)parameter
PML_TYPE_CLASSIC_DIRECTcharacter(len=14)parameter
GRMS_3DB_RATIOreal(kind=R8P)parameter

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.
flailtype(flail_object)FLAIL, the elliptic solver library (issue #84).
wenotype(weno_object)WENO reconstructor.
with_wenologicalRead [weno] and initialize weno (the app clears it when unused, #80 P5).
with_fdvlogicalRead [fdv] and bind the FD/FV operators (cleared when unused, #80 P5).
ibtype(ib_object)Immersed boundary.
tstype(stepper_object)Time integrator on SELAH (stepper_object, #132).
selah_layoutinteger(kind=I4P)Layout of the fields ts integrates (the FNL apps set LAYOUT_V_LAST, their (b, i, j, k, v) device fields).
selah_partitionsinteger(kind=I4P)The variables (first, last) of the two partitions of a splitting scheme (PRISM's Yoshida: B then D); 0 for none.
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. 1-based position of this realm in the forest's realm(:) array, or 0 in the N=1 single-realm legacy path (where the program driver calls realm%initialize_forest directly, bypassing the forest orchestrator).
realm_indexinteger(kind=I4P)
realms_numberinteger(kind=I4P)Realms in the forest (set by initialize_forest, #80 P3). Inter-realm seam coupling — currently-published stage buffer key.
stage_activeinteger(kind=I4P)A copy of the forest's flux register (its faces and lookup, the accumulators unused), refreshed by the forest each time it builds the register (init, regrid). A realm can accumulate one residual evaluation's seam fluxes into it for a diagnostic without touching the forest's step accumulators (FLUME's D_flux, issue #68 A2).
flux_register_copytype(flux_register_object)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_curl_extendedprocedure(compute_curl_interface)pass(self), pointerCompute curl on extended support.
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_gradient_extendedprocedure(compute_gradient_interface)pass(self), pointerCompute gradient on extended support.
compute_laplacianprocedure(compute_laplacian_interface)pass(self), pointerCompute laplac.
save_em_onlylogical[IO] save_fields = em: the XH5F output holds D and B only.
amr_locked_logicalAMR regrid lock (issue #22 GA6): set .true. by backends whose device/topology state cannot follow a regrid after initialization (FNL sets it at the end of initialize_forest); amr_update error_stops when locked. CPU never sets it.
blocks_fields_numberinteger(kind=I4P)Block-sized fields per block of the blocks budget (issue #112).
reserved_memoryreal(kind=R8P)Memory reserved outside the blocks by the budget, GB (issue #112).
restarted_atinteger(kind=I4P)Iteration the run restarted from (-1: not a restart), issue #129 R6.
estimate_backend_memoryprocedure(estimate_backend_memory_interface)pointer, nopassBackend memory outside the block fields, estimated before the blocks budget (issue #112); set by the backend before initialize, none when null (CPU).
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.
single_particle_output_last_timereal(kind=R8P)Last time written to single-particle history.
single_particle_output_writtenlogicalSingle-particle history write sentinel.
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.
grmstype(prism_grms_object)Grms diagnostic.
ictype(prism_ic_object)Initial conditions.
io_prismtype(prism_io_object)The [IO] options only PRISM reads.
magnetic_field_at_center_domaintype(prism_magnetic_field_at_center_domain_object)Domain-center B diagnostic.
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.
plasma_freqtype(prism_plasma_frequencies_object)Plasma frequencies and the PIC time-step limit.
pmltype(prism_pml_object)Perfectly matched layer.
probestype(prism_probes_object)Field probes.
pic_sttype(stepper)Particles: a SELAH companion (#134 D5).
pml_sttype(prism_pml_stepper_object)PML auxiliary fields: SELAH companions (#134 D5).
timetype(prism_time_object)Time integration state.
field_fnltype(field_fnl_object)GPU field handler.
ib_fnltype(ib_fnl_object)GPU immersed boundary.
coil_fnltype(prism_fnl_coil_object)GPU coil source.
pic_fnltype(prism_fnl_pic_object)GPU PIC support state.
conserving_fnltype(prism_fnl_pic_conserving_object)GPU charge-conserving PIC current.
plasma_freq_fnltype(prism_fnl_plasma_frequencies_object)GPU plasma frequencies (PIC time-step limit).
pml_fnltype(prism_fnl_pml_object)GPU PML compact metadata/state.
probes_fnltype(prism_fnl_probes_object)GPU field probes.
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.
j_vec_tv_gpureal(kind=R8P)pointerCell total variation of the coil j_vec (AMR_TV marker only).
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.
db6integer(kind=I4P)Device data bounds (rank 6): bb(1,:)=lower, bb(2,:)=upper.
hb6integer(kind=I4P)Host buffer data bounds (rank 6): bb(1,:)=lower, bb(2,:)=upper.
buf_6D_R8Preal(kind=R8P)allocatableBuffer (host memory, device shape), rank 6, R8P.
fv_flux_variantinteger(kind=I4P)FV Maxwell-flux variant selector.
fv_add_phi_dampinglogicalApply phi damping in FV residuals.
fv_add_psi_dampinglogicalApply psi damping in FV residuals.
fv_ivar_phiinteger(kind=I4P)Phi slot index in FV residuals.
fv_ivar_psiinteger(kind=I4P)Psi slot index in FV residuals.
fd_residual_variantinteger(kind=I4P)Centered-FD residual selector.
fd_ivar_phiinteger(kind=I4P)Phi slot index in FD residuals.
fd_ivar_psiinteger(kind=I4P)Psi slot index in FD residuals.
fd_inv_mu_scalereal(kind=R8P)Dimensional/adimensional scaling on curl(B).
fd_inv_eps_scalereal(kind=R8P)Dimensional/adimensional scaling on curl(D).
fd_chi_wavereal(kind=R8P)Hyperbolic transport speed for phi/psi equations.
fd_alpha_dampreal(kind=R8P)GLM damping rate for phi/psi equations. Pointer (abstract) TBP.
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.
charge_conservation_acc_gpureal(kind=R8P)pointerPIC charge-continuity residual accumulator.
charge_conservation_divj_gpureal(kind=R8P)pointerPIC temporary div(J) for charge diagnostic.
charge_conservation_error_maxreal(kind=R8P)Max PIC charge-continuity residual.
charge_conservation_readylogicalTrue when current step PIC diagnostic is ready.
charge_conservation_steplogicalTrue when this PIC step feeds the history.
stage_ghosts_freshlogicalupdate_ghost skips the exchange (boundary conditions and coil re-stamp kept): the caller refreshed the ghosts and changed only pointwise sources since. Set around one call, then cleared.

Type-Bound Procedures

NameAttributesDescription
load_fdv_from_filepass(self)Load FDV config from file.
initialize_forestpass(self), non_overridableInvoked by forest%initialize per realm: the template.
runtime_amr_forestpass(self)Whether this realm regrids during the run (#74).
regrid_forestpass(self)Invoked by forest%regrid per realm per timestep (#74).
regrid_begin_forestpass(self)Multi-realm regrid, phase 1: is it a regrid step (#110).
regrid_mark_forestpass(self)Phase 2: mark one sweep, marks on the tree (#110).
regrid_apply_forestpass(self)Phase 3: adapt to the (balanced) tree marks (#110).
regrid_end_forestpass(self)Phase 4: refresh the grid-dependent state (#110).
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.
compute_curl_fd_extendedpass(self)Compute curl of vector field, finite difference, even for half gcs.
compute_gradient_fd_extendedpass(self)Compute gradient of scalar field, finite difference, even for half gcs. private FDV operators
amr_update_initial_forestpass(self)Template hook: one initial regrid (host).
initial_amr_iterations_forestpass(self)Template hook: [initial_conditions] AMR passes.
rebalance_initial_forestpass(self)Template hook: the static rebalance (issue #123).
reset_time_forestpass(self)Template hook: time and step counter to zero.
mark_by_geometrypass(self)Mark blocks to be refined by a primitive geometric box.
allocate_commonpass(self)Allocate common data.
compute_auxiliary_fieldspass(self)Compute auxiliary fields.
compute_fields_numberpass(self)Compute the block-sized fields allocated per block.
initializepass(self)Initialize the equation common data.
initialize_block_face_datapass(self)(Re)build the per-block face data on the current grid.
fold_deposited_ghostspass(self)Fold PIC deposits spilled into ghosts, locally and across ranks.
initialize_pic_time_zeropass(self)Host-side PIC particle injection plus charge/current deposition at t=0.
register_pic_deposition_on_coilspass(self)Keep the plasma current a PIC deposit put on coil cells.
report_plasma_on_coilspass(self)Repeat at the end of the run the warning of plasma on coil cells.
weight_pic_fields_time_zeropass(self)Host-side PIC field interpolation at t=0.
save_pic_self_force_diagnostic_time_zeropass(self)Temporary PIC self-force diagnostic at t=0.
save_energy_errorpass(self)Save energy error history.
save_energy_historypass(self)Save energy history.
save_coils_current_diagnosticspass(self)Save instantaneous coil-current diagnostics.
save_divergence_historypass(self)Save divergence history.
save_grms_historypass(self)Save Grms history.
save_magnetic_field_at_center_domain_historypass(self)Save domain-center B history.
save_probes_historypass(self)Save the field probes history on its cadence.
save_restart_filespass(self)Save restart files.
save_slicespass(self)Save the slices on their cadence.
save_xh5fpass(self)Save simulation data in XH5F format.
initialize_coilspass(self)Initialize coils.
compute_coils_current_time_zeropass(self)Host-side coil current initialization at t=0.
impose_pic_fields_time_zeropass(self)Host-side elliptic initialization for PIC/current-driven fields.
has_current_densitypass(self)True if the current density is non-zero on any rank.
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.
compute_rectangular_current_flux_sidespass(self)Precompute rectangular side-current fluxes.
compute_helicon_current_flux_segmentspass(self)Precompute helicon segment-current fluxes.
coupling_descriptor_forestpass(self)Report (scheme_time, rk_scheme, nv) for β admissibility.
save_charge_conservation_diagnosticpass(self)Save PIC charge-continuity diagnostic.
finalize_charge_conservation_diagnosticpass(self)Finalize PIC charge-continuity diagnostic.
accumulate_charge_conservation_currentpass(self)Accumulate weighted PIC stage div(J).
initialize_charge_conservation_diagnosticpass(self)Initialize PIC charge-continuity diagnostic.
allocate_gpupass(self)Allocate GPU data.
amr_updatepass(self)Override: the common AMR update, then the device PML twins.
rebalancepass(self)Override: the common rebalance (issue #123), then the device PML twins.
copy_cpu_gpupass(self)Copy data from CPU to GPU.
copy_gpu_cpupass(self)Copy data from GPU to CPU.
destroypass(self)Free device data owned by this realm.
initialize_prismpass(self)Initialize PRISM equation.
initialize_pml_fnlpass(self)(Re)build the device PML twins from the host PML.
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.
register_pic_deposition_on_coils_devpass(self)Keep the plasma current a deposit put on coil cells.
mark_by_j_vec_total_variationpass(self)Override: device TV marker (common default error_stops).
set_boundary_conditionspass(self)Set boundary conditions of equation.
set_initial_conditionspass(self)Set initial conditions of equation.
fold_deposited_ghosts_devpass(self)Fold PIC deposits spilled into ghosts, locally and across ranks.
gather_pic_fields_devpass(self)Gather E, B at the particles (coherent matched gathers included).
migrate_particlespass(self)Migrate particles between ranks (end of a time step).
sync_particle_numberpass(self)Align the device helpers to the local particle count.
update_ghostpass(self)Update ghost cells and set boundary conditions.
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.
apply_pml_fd_centered_ade_devpass(self)Add ADE-PML terms to FD-centered residuals.
compute_residuals_fd_centered_devpass(self)Compute residuals, centered finite difference schemes.
integrate_rk_ls_devpass(self)RK classical low storage schemes.
integrate_rk_ssp_devpass(self)SSP RK schemes.
initialize_app_forestpass(self)Template hook: the PRISM backend.
restart_state_forestpass(self)Template hook: the state from the restart files.
set_initial_state_forestpass(self)Template hook: the initial conditions.
post_initial_state_forestpass(self)Template hook: ghosts, t0 diagnostics, history files.
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).
initialize_process_contextpass(self)Process-global MPI init (mpih_fnl + mpih), once.
fill_seam_from_peer_forestpass(self)OpenACC device-direct copy of peer's GPU interior into self's GPU
seam_ghosts_to_statepass(self)Copy the end_of_step seam ghosts into the stage state (#132). ghosts.
pack_seam_cells_forestpass(self)Pack own cells of the cross-rank seam send rows.
unpack_seam_cells_forestpass(self)Unpack the cross-rank seam receive rows into own 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_plasma_frequenciespass(self)Plasma frequencies limiting the next PIC step.
locate_particles_end_of_steppass(self)Particle-cell map of the final positions (#129 R7).
compute_energypass(self)Compute energy.
compute_energy_errorpass(self)Compute energy error.
compute_grmspass(self)Compute Grms of the rotating magnetic-field amplitude.
compute_magnetic_field_at_center_domainpass(self)Compute B at the domain center.
sample_probespass(self)Override: sample the probes on the device.
sync_probespass(self)Override: copy the probe stencils to the device.
compute_max_divergencepass(self)Compute divergence of D, B and J fields for diagnostics.
compute_max_divergence_outside_absorbing_layerspass(self)Host twin of the CPU t0 diagnostic.
simulatepass(self)Perform the simulation.

prism_fnl_object%load_fdv_from_file ​

Load FDV config from file.

fortran
subroutine load_fdv_from_file(self, file_parameters)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe equation.
file_parameterstype(file_ini)inSimulation parameters ini file handler.

Call graph

prism_fnl_object%initialize_forest ​

Initialize this realm, the library template (issue #80 P3): the sequence every application shares, its steps delegated to the *_forest hooks below.

fortran
 call self%initialize_app_forest(filename, realms_number) ! parse, build the library and app objects, the backend
 if (self%io%restart) then
    call self%restart_state_forest                        ! the state from the restart files
 else
    do i=1, self%initial_amr_iterations_forest()          ! the initial state, then a regrid on it, n times
       call self%set_initial_state_forest
       call self%amr_update_initial_forest
    enddo
    call self%rebalance_initial_forest                    ! [amr].(balance_static)
    call self%set_initial_state_forest                    ! the initial state on the final grid
    call self%adam%make_comm_local_maps_ghost_bc          ! the maps of the final grid
    call self%reset_time_forest
 endif
 call self%post_initial_state_forest                     ! device push, ghosts, t0 diagnostics, history files

Invoked by forest%initialize once per realm at startup, before the time loop; MPI and the device are up already (initialize_process_context). The forest sets self%realm_index = is BEFORE invoking it, so the hooks can read their forest position for per-realm IO filenames, log prefixes, etc. The template is non-overridable: an application implements the hooks, whose defaults error-stop, except restart_state_forest, which refuses [IO].(restart) = .true..

fortran
subroutine initialize_forest(self, filename, realms_number)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
filenamecharacter(len=*)inInput parameters file name.
realms_numberinteger(kind=I4P)inoptionalRealm count in the forest.

Call graph

prism_fnl_object%runtime_amr_forest ​

Return whether this realm regrids during the time loop (issue #74, runtime AMR).

The forest asks it before every regrid: with a realm that regrids, a multi-realm forest fills its seams before the realms mark and balances their marks across the seams (issue #110). Default: no runtime regridding, the behaviour of every app before #74; an app that regrids overrides it.

Returns: logical

fortran
function runtime_amr_forest(self) result(yes)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inThe realm.

Call graph

prism_fnl_object%regrid_forest ​

Regrid this realm if its cadence asks for it now (issue #74, runtime AMR).

Invoked by forest%regrid once per realm after post_step_forest, on committed q (no stage active). The realm marks its blocks, calls adam%amr_update and refreshes its grid-dependent state; regridded tells the forest whether the tree changed, so it rebuilds what it owns (the flux register). Default: never regrid.

fortran
subroutine regrid_forest(self, regridded)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
regriddedlogicaloutTrue if the tree changed.

Call graph

prism_fnl_object%regrid_begin_forest ​

Start a multi-realm regrid of this realm: active if its cadence asks for a regrid now (issue #110).

fortran
subroutine regrid_begin_forest(self, active)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
activelogicaloutThis realm marks its blocks at this step.

Call graph

prism_fnl_object%regrid_mark_forest ​

Mark the blocks of this realm for sweep sweep and gather the marks on its replicated tree (issue #110).

marked is false when the realm does not mark in this sweep (no regrid step, or more sweeps than its [amr] iters); the forest then clears its tree marks before balancing the seams.

fortran
subroutine regrid_mark_forest(self, sweep, marked)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
sweepinteger(kind=I4P)inSweep of the regrid, from 1.
markedlogicaloutThe realm marked its blocks.

Call graph

prism_fnl_object%regrid_apply_forest ​

Adapt this realm to the marks on its replicated tree, as the forest balanced them (issue #110).

fortran
subroutine regrid_apply_forest(self, changed)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
changedlogicaloutThe tree changed.

Call graph

prism_fnl_object%regrid_end_forest ​

End a multi-realm regrid of this realm: refresh the state of the new grid, regridded if any sweep changed it.

fortran
subroutine regrid_end_forest(self, regridded)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
regriddedlogicaloutThe tree changed in some sweep.

Call graph

prism_fnl_object%close_block_xh5f ​

Close XH5F file block.

fortran
subroutine close_block_xh5f(xh5f)

Arguments

NameTypeIntentAttributesDescription
xh5ftype(xh5f_file_object)inoutXH5F file handler.

Call graph

prism_fnl_object%close_file_xh5f ​

Close XH5F file.

fortran
subroutine close_file_xh5f(xh5f)

Arguments

NameTypeIntentAttributesDescription
xh5ftype(xh5f_file_object)inoutXH5F file handler.

Call graph

prism_fnl_object%open_block_xh5f ​

Open XH5F file block; length_scale multiplies the written block origin and spacing (output units of an application, e.g. FLUME [reference] output_units). The origin is the corner of the first stored cell: ngc_saved cells below the block's first interior cell, ngc_saved the ghost layers the caller writes (default all, ngc; 0 for the interior only, e.g. the restart snapshot, issue #109).

fortran
subroutine open_block_xh5f(self, xh5f, b, nijk, t, time, length_scale, ngc_saved)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe equation.
xh5ftype(xh5f_file_object)inoutXH5F file handler.
binteger(kind=I4P)inBlock index.
nijkinteger(kind=I8P)inBlocks dimensions.
tinteger(kind=I4P)inoptionalTime iteration.
timereal(kind=R8P)inoptionalTime.
length_scalereal(kind=R8P)inoptionalScale of the written origin and spacing.
ngc_savedinteger(kind=I4P)inoptionalGhost layers written (default ngc).

Call graph

prism_fnl_object%open_file_xh5f ​

Open XH5F file.

fortran
subroutine open_file_xh5f(self, basename, xh5f, directory)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe equation.
basenamecharacter(len=*)inBase name of output files.
xh5ftype(xh5f_file_object)outXH5F file handler.
directorycharacter(len=*)inoptionalDirectory name of output files.

Call graph

prism_fnl_object%save_q_xh5f ​

Save ADAM in XH5F format.

fortran
subroutine save_q_xh5f(self, basename, q, q_name, directory, with_ghost, with_cell_morton, t, time)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe equation.
basenamecharacter(len=*)inBase name of output files.
qreal(kind=R8P)inQ-vector variables [nv,ni,nj,nk,nb].
q_namecharacter(len=*)inoptionalQ-vector variables names [nv].
directorycharacter(len=*)inoptionalDirectory name of output files.
with_ghostlogicalinoptionalFlag to save ghost cells.
with_cell_mortonlogicalinoptionalFlag to save Morton code also in cells.
tinteger(kind=I4P)inoptionalTime iteration.
timereal(kind=R8P)inoptionalTime.

Call graph

prism_fnl_object%compute_curl_fd_extended ​

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

fortran
subroutine compute_curl_fd_extended(self, hs, ivar, q, curl)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inThe equation.
hsinteger(kind=I4P)inFDV half stencil length.
ivarinteger(kind=I4P)inStart index of variable of q.
qreal(kind=R8P)inField variables.
curlreal(kind=R8P)inoutCurl.

Call graph

prism_fnl_object%compute_gradient_fd_extended ​

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

fortran
subroutine compute_gradient_fd_extended(self, hs, ivar, q, gradient)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inThe equation.
hsinteger(kind=I4P)inFDV half stencil length.
ivarinteger(kind=I4P)inIndex of scalar variable of q.
qreal(kind=R8P)inField variables.
gradientreal(kind=R8P)inoutGradient.

Call graph

prism_fnl_object%amr_update_initial_forest ​

One initial regrid on the host (the FNL override of amr_update follows it with the device PML twins).

fortran
subroutine amr_update_initial_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_fnl_object%initial_amr_iterations_forest ​

The passes of initial conditions + regrid before the final initial conditions, ic%amr_iterations.

Returns: integer(kind=I4P)

fortran
function initial_amr_iterations_forest(self) result(n)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inThe equation.

Call graph

prism_fnl_object%rebalance_initial_forest ​

PRISM regrids at initialization only: balance the blocks by count, sibling sets split (issue #123).

fortran
subroutine rebalance_initial_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_fnl_object%reset_time_forest ​

The time and the step counter of a run from scratch to zero (dt is kept: the conserving PIC t0 path set it).

fortran
subroutine reset_time_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_fnl_object%mark_by_geometry ​

Mark blocks to be refined by a primitive axis-aligned box (deterministic, solution-independent).

A block is flagged TO_BE_REFINED iff its centroid lies inside [box_emin, box_emax] AND its current refinement level is below target_level. This is the AMR_GEO + AMR_GEO_PRIMITIVE_BOX marker: it produces a deterministic 2:1 coarse-fine jump at known coordinates, decoupled from the IB/solid geometry, for the issue #13 intra-realm AMR seam test fixture (#13 §7.5, M0).

fortran
subroutine mark_by_geometry(self, box_emin, box_emax, target_level, do_init)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.
box_eminreal(kind=R8P)inBox minimum corner.
box_emaxreal(kind=R8P)inBox maximum corner.
target_levelinteger(kind=I4P)inRefine blocks below this level.
do_initlogicalinoptionalRe-initialize refinements queries.

Call graph

prism_fnl_object%allocate_common ​

Allocate common data.

fortran
subroutine allocate_common(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_fnl_object%compute_auxiliary_fields ​

Compute auxiliary fields.

fortran
subroutine compute_auxiliary_fields(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_fnl_object%compute_fields_number ​

Compute the block-sized fields PRISM allocates per block, the fields_number of the blocks budget.

Both backends allocate the same nb-sized arrays, on the host (CPU) or on the device (FNL), so one count serves both: q, dq, curl, divergence (4 nv), the time integrator's registers (SELAH's, stepper_stored_fields nv: the stage states and residuals, the residual register included, #132), the coils current density (3 per coil), the two PIC charge-continuity accumulators (only with a charge-conservation history), and the flux arrays of the scheme in use: the cell fluxes flxyz_c (9 nv) for FV and WENO, the face fluxes (3 nv, counted as full block fields) for FV only, none for centered FD (issue #112). Backend-only arrays are added by the backend estimate of initialize; face-local PML storage is not block-sized and is not counted. The FNL estimate also takes curl and divergence off the count: there they are host arrays only, recomputed from q at the saves (issue #112 C). Requires physics and numerics initialized and [runge_kutta] parsed into rk; loads the coils number (it needs no grid or field).

fortran
subroutine compute_fields_number(self, file_parameters, fields_number)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.
file_parameterstype(file_ini)inSimulation parameters ini file handler.
fields_numberinteger(kind=I4P)outBlock-sized fields allocated per block.

Call graph

prism_fnl_object%initialize ​

Initialize the equation common data.

fortran
subroutine initialize(self, filename, memory_avail, nv, fields_number, verbose, L0)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inouttargetThe equation.
filenamecharacter(len=*)inInput file name.
memory_availreal(kind=R8P)invalueMemory available for single MPI process.
nvinteger(kind=I4P)inoptionalNumber of field variables.
fields_numberinteger(kind=I4P)inoptionalBlock-sized fields per block (default: computed).
verboselogicalinoptionalTrigger verbose output.
L0real(kind=R8P)inoptionalAdimensionalization parameter.

Call graph

prism_fnl_object%initialize_block_face_data ​

(Re)build the per-block face data on the current grid: the PEC faces of the external fields, the fWLayer ranges and the PML support with its RK storage. All are indexed by local block, so they must follow every change of the block set: the uniform refinement in initialize, each init-time amr_update, a restart (issue #95, P5.1). Every initializer called here resets its object first; the PML auxiliary state restarts from zero, as at any initialization.

fortran
subroutine initialize_block_face_data(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_fnl_object%fold_deposited_ghosts ​

Fold the PIC deposits that spilled into ghost cells back onto the cells they mirror, on this rank and across ranks, then refill the ghosts: the result equals a single-block deposit of the same particles. With one rank this is reduce_ghost_local alone. Collective.

fortran
subroutine fold_deposited_ghosts(self, q, v_first, v_last)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.
qreal(kind=R8P)inoutField variables.
v_firstinteger(kind=I4P)inFirst variable to fold.
v_lastinteger(kind=I4P)inLast variable to fold.

Call graph

prism_fnl_object%initialize_pic_time_zero ​

Initialize PIC particles and deposit host-side charge/current sources at t=0.

fortran
subroutine initialize_pic_time_zero(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_fnl_object%register_pic_deposition_on_coils ​

Right after a PIC deposit into q: plasma current or charge on the coil support is no longer an error. The current is kept (committed or stage slot) and summed with the coil current by every later coil stamp of that state; the first occurrence is warned and repeated at the end of the run (report_plasma_on_coils). Collective (with coils): the overlap is reduced over the ranks and, when found, the ghosts of q are refreshed before the support (ghost cells included) is kept, so a ghost copy of a support cell carries its plasma current too. Without overlap q is untouched.

fortran
subroutine register_pic_deposition_on_coils(self, q, stage, check_current, check_charge, context)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.
qreal(kind=R8P)inoutDeposited field.
stagelogicalinq is a stage state (else the committed one).
check_currentlogicalinoptionalThe J rows hold a fresh deposit.
check_chargelogicalinoptionalThe charge row holds a fresh deposit.
contextcharacter(len=*)inoptionalCall-site label.

Call graph

prism_fnl_object%report_plasma_on_coils ​

End of the run: repeat the warning of plasma deposited on coil cells, with the first iteration (and its call site) and the last one over all the ranks. Collective.

fortran
subroutine report_plasma_on_coils(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inThe equation.

Call graph

prism_fnl_object%weight_pic_fields_time_zero ​

Interpolate initialized fields at particle positions at t=0.

fortran
subroutine weight_pic_fields_time_zero(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_fnl_object%save_pic_self_force_diagnostic_time_zero ​

Temporary diagnostic for single-particle PIC self-force analysis.

fortran
subroutine save_pic_self_force_diagnostic_time_zero(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)in

Call graph

prism_fnl_object%save_energy_error ​

Save energy error history.

fortran
subroutine save_energy_error(self, is_to_open, is_to_close)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.
is_to_openlogicalinoptionalFlag to open file before first saving.
is_to_closelogicalinoptionalFlag to close file after last saving.

Call graph

prism_fnl_object%save_energy_history ​

Save energy history.

fortran
subroutine save_energy_history(self, is_to_open, is_to_close)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.
is_to_openlogicalinoptionalFlag to open file before first saving.
is_to_closelogicalinoptionalFlag to close file after last saving.

Call graph

prism_fnl_object%save_coils_current_diagnostics ​

Save instantaneous coil-current diagnostics.

fortran
subroutine save_coils_current_diagnostics(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_fnl_object%save_divergence_history ​

Save divergence history.

fortran
subroutine save_divergence_history(self, is_to_open, is_to_close, div_D, div_B, div_J, current_solver_residual)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.
is_to_openlogicalinoptionalFlag to open file before first saving.
is_to_closelogicalinoptionalFlag to close file after last saving.
div_Dreal(kind=R8P)inMaximum of divergence of D field.
div_Breal(kind=R8P)inMaximum of divergence of B
div_Jreal(kind=R8P)inMaximum of divergence of J field.
current_solver_residualreal(kind=R8P)inoptionalMaximum current linear-solve residual.

Call graph

prism_fnl_object%save_grms_history ​

Save Grms history.

fortran
subroutine save_grms_history(self, is_to_open, is_to_close)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.
is_to_openlogicalinoptionalFlag to open file before first saving.
is_to_closelogicalinoptionalFlag to close file after last saving.

Call graph

prism_fnl_object%save_magnetic_field_at_center_domain_history ​

Save domain-center magnetic-field history.

fortran
subroutine save_magnetic_field_at_center_domain_history(self, is_to_open, is_to_close)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.
is_to_openlogicalinoptionalFlag to open file before first saving.
is_to_closelogicalinoptionalFlag to close file after last saving.

Call graph

prism_fnl_object%save_probes_history ​

Save the field probes history on its cadence ([probes] save_every and the last step); collective.

With is_to_open the stencils are built on the current grid, synced with the backend and the files opened. The probes sample q as stored: the external fields, if any, are not added.

fortran
subroutine save_probes_history(self, is_to_open)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.
is_to_openlogicalinoptionalFlag to open the files before the first saving.

Call graph

prism_fnl_object%save_restart_files ​

Save restart files.

fortran
subroutine save_restart_files(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_fnl_object%save_slices ​

Save the slices (library slices_object, [slices] / [slice_N]) on their cadence, one file per field set: <basename>-slice_NN-<it>.mat holds q (the total field when external fields are applied, as the XH5F output), <basename>-curl-slice_NN-<it>.mat and <basename>-div-slice_NN-<it>.mat the curl and divergence fields when their XH5F output is enabled ([IO] save_curl_fields, save_divergence_fields). The caller has refreshed the ghost cells of the host q and computed the auxiliary fields. These are computed on the interior cells only, so their intra-realm ghost cells are refreshed here: the stencil of a point in the half cell next to a block face reads them. Their physical-boundary ghost cells are not set: a point in the half cell next to the domain boundary interpolates with them.

fortran
subroutine save_slices(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_fnl_object%save_xh5f ​

Save simulation data in HDF5 format.

fortran
subroutine save_xh5f(self, output_basename, with_ghost)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.
output_basenamecharacter(len=*)inoptionalOutput basename.
with_ghostlogicalinoptionalFlag to save ghost cells.

Call graph

prism_fnl_object%initialize_coils ​

Initialize coils.

fortran
subroutine initialize_coils(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_fnl_object%compute_coils_current_time_zero ​

Compute coils current sources on the host at time t=0.

fortran
subroutine compute_coils_current_time_zero(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_fnl_object%impose_pic_fields_time_zero ​

Compute initial condition for the fields in presence of plasma or current sources.

The electric field (PIC): D(G) phi = -rho/eps, then D <- D - eps G phi. The magnetic field: D(G) A_d = -mu J_d per component, then B <- B + curl A. D(G) is PRISM's own operator, the order-p centred derivative composed with itself (fdv_order), so the corrected field satisfies div D = rho to round-off with PRISM's divergence (issue #84, E3a). The solves run by FLAIL's FFT solver (E3b); an exact/open face holds the free-space potential of the source in its ghosts, summed over the whole domain (E3c). A refined grid is refused: the wide operator across 2:1 faces is not defined yet (E7).

The correction is written in the interior cells only: the caller refreshes the ghosts of the corrected field (exchange and boundary conditions, refresh_time_zero_ghosts of each backend), as every stage does before reading them. The former extension of the gradient/curl into the first ngc/2 ghost layers read the potential ngc/2 + hs layers deep, which tied ngc to 2 hs (issue #112, the ghost cells of FD6) for values every stage overwrites.

fortran
subroutine impose_pic_fields_time_zero(self, ivar)

Arguments

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

Call graph

prism_fnl_object%has_current_density ​

Return true if the current density (host q) is non-zero on any rank; every rank must call it. It decides whether the elliptic magnetic-field initialization runs. A rank-local test let the ranks holding current enter that solve while the others skipped it, and the solve's ghost exchange then waited forever (issue #84).

Returns: logical

fortran
function has_current_density(self) result(has)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inThe equation.

Call graph

prism_fnl_object%set_rectangular_coil_x ​

Set rectangular coil with normal direction parallel to x.

fortran
subroutine set_rectangular_coil_x(self, n, verse)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutCpu object.
ninteger(kind=I4P)inCoil number.
versereal(kind=R8P)inCoil normal direction, +1=+x, -1=-x.

Call graph

prism_fnl_object%set_rectangular_coil_y ​

Set rectangular coil with normal direction parallel to y.

fortran
subroutine set_rectangular_coil_y(self, n, verse)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutCpu object.
ninteger(kind=I4P)inCoil number.
versereal(kind=R8P)inCoil normal direction, +1=+y, -1=-y.

Call graph

prism_fnl_object%set_rectangular_coil_z ​

Set rectangular coil with normal direction parallel to z.

fortran
subroutine set_rectangular_coil_z(self, n, verse)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutCpu object.
ninteger(kind=I4P)inCoil number.
versereal(kind=R8P)inCoil normal direction, +1=+z, -1=-z.

Call graph

prism_fnl_object%set_circular_coil_x ​

Set circular coil with normal direction parallel to x.

fortran
subroutine set_circular_coil_x(self, n, verse)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutCpu object.
ninteger(kind=I4P)inCoil number.
versereal(kind=R8P)inCoil normal direction, +1=+x, -1=-x.

Call graph

prism_fnl_object%set_circular_coil_y ​

Set circular coil with normal direction parallel to y.

fortran
subroutine set_circular_coil_y(self, n, verse)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutCpu object.
ninteger(kind=I4P)inCoil number.
versereal(kind=R8P)inCoil normal direction, +1=+y, -1=-y.

Call graph

prism_fnl_object%set_circular_coil_z ​

Set circular coil with normal direction parallel to z.

fortran
subroutine set_circular_coil_z(self, n, verse)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutCpu object.
ninteger(kind=I4P)inCoil number.
versereal(kind=R8P)inCoil normal direction, +1=+z, -1=-z.

Call graph

prism_fnl_object%set_solenoid_x ​

Set solenoid with axis direction parallel to x.

fortran
subroutine set_solenoid_x(self, n, verse)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutCpu object.
ninteger(kind=I4P)inCoil number.
versereal(kind=R8P)inSolenoid axis direction, +1=+x, -1=-x.

Call graph

prism_fnl_object%set_solenoid_y ​

Set solenoid with axis direction parallel to y.

fortran
subroutine set_solenoid_y(self, n, verse)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutCpu object.
ninteger(kind=I4P)inCoil number.
versereal(kind=R8P)inSolenoid axis direction, +1=+y, -1=-y.

Call graph

prism_fnl_object%set_solenoid_z ​

Set solenoid with axis direction parallel to z.

fortran
subroutine set_solenoid_z(self, n, verse)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutCpu object.
ninteger(kind=I4P)inCoil number.
versereal(kind=R8P)inSolenoid axis direction, +1=+z, -1=-z.

Call graph

prism_fnl_object%set_helicon_coil ​

Set helicon coil.

fortran
subroutine set_helicon_coil(self, n)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutCpu object.
ninteger(kind=I4P)inCoil number.

Call graph

prism_fnl_object%compute_rectangular_current_flux_sides ​

Numerically measure the current crossing each local side-normal section of a rectangular coil.

fortran
subroutine compute_rectangular_current_flux_sides(self, coil_id, i_dir_n, i_dir_a, i_dir_b, a1, a2, b1, b2, verse)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.
coil_idinteger(kind=I4P)inCoil index.
i_dir_ninteger(kind=I4P)inCoil-normal direction.
i_dir_ainteger(kind=I4P)inFirst in-plane direction.
i_dir_binteger(kind=I4P)inSecond in-plane direction.
a1real(kind=R8P)inBounds along the local a direction.
a2real(kind=R8P)inBounds along the local a direction.
b1real(kind=R8P)inBounds along the local b direction.
b2real(kind=R8P)inBounds along the local b direction.
versereal(kind=R8P)inCoil orientation sign.

Call graph

prism_fnl_object%compute_helicon_current_flux_segments ​

Numerically measure the current crossing each local segment-normal section.

fortran
subroutine compute_helicon_current_flux_segments(self, coil_id)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.
coil_idinteger(kind=I4P)inCoil index.

Call graph

prism_fnl_object%coupling_descriptor_forest ​

Report this realm's coupling descriptor for β admissibility.

Returns (numerics%scheme_time, rk%scheme, physics%nv). β admits a seam between two realms iff all three values agree. Spatial operator (numerics%scheme_space) is intentionally NOT in the descriptor — β exists precisely to support different spatial operators per realm.

Provided on prism_common_object so both prism_cpu_object and prism_fnl_object inherit a single implementation.

fortran
subroutine coupling_descriptor_forest(self, scheme_time, rk_scheme, nv)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inThe realm.
scheme_timecharacter(len=:)outallocatableTime-integration family tag ("runge_kutta", "leapfrog", ...).
rk_schemecharacter(len=:)outallocatableWithin-family scheme tag ("runge-kutta-ssp-54", ...).
nvinteger(kind=I4P)outNumber of conserved variables on this realm.

Call graph

prism_fnl_object%seam_ghosts_to_state ​

Copy the seam ghosts of q into the stage state u, for the peer slots of the given cadence (#132 rule 1).

SELAH's Butcher form keeps the state of the active stage in one register and never writes a ghost cell: called when each stage opens, after the stepper built its state, it gives that stage the peer state of the step's alpha fill, the peer state at the start of the step (the alpha cadence).

fortran
subroutine seam_ghosts_to_state(maps, cadence, ngc, q, u)

Arguments

NameTypeIntentAttributesDescription
mapstype(maps_object)inMaps of the realm owning the ghosts.
cadenceinteger(kind=I4P)inCadence of the slots copied.
ngcinteger(kind=I4P)inGhost cells number.
qreal(kind=R8P)inCommitted state (v, i, j, k, b).
ureal(kind=R8P)inoutStage state (v, i, j, k, b).

Call graph

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 ​

destroy ​

Free device data owned by this PRISM FNL realm.

fortran
subroutine destroy(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

free_prism_core_gpu ​

Free raw device buffers allocated directly by prism_fnl_object%allocate_gpu.

fortran
subroutine free_prism_core_gpu(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

estimate_backend_memory_fnl ​

Device memory of the PIC that the block fields of compute_fields_number do not count, estimated from the input before the grid exists (issue #112), so that the blocks budget leaves it free. Set as prism_common_object%estimate_backend_memory before the common initialize.

extra_fields: the correction to the block fields of compute_fields_number on the device, which may be negative: -2 nv for curl and divergence, host arrays only in FNL (issue #112 C), +1 for j_vec_tv_gpu with an AMR_TV marker; plus, under PIC, the fields on the block slots, from the functions their objects allocate by (issue #130, 8-bis): plasma_frequencies_block_fields (wp2_gpu) and conserving_layout%slot_fields (gq_gpu, 6, coherent gather; gather_gpu, nv, with external fields). reserved_memory: the particle arrays, sized on the particle capacity of a rank, [PIC].(particle_capacity_factor) (q_pic_gpu, pic_fields_gpu, neighbour_list_gpu, the time scheme stages, the migration buffers, the conserving histories), and the virtual block of the conserving current, the whole domain at the finest uniform level. The bytes are those the objects allocate, from the functions they allocate by (issue #130): pic_fnl_device_bytes, the SELAH registers of the particles' companion and conserving_layout%device_bytes. PML storage and the runtime context are left to the [amr].(memory_fraction) headroom.

fortran
subroutine estimate_backend_memory_fnl(physics, file_parameters, rk_scheme, extra_fields, reserved_memory)

Arguments

NameTypeIntentAttributesDescription
physicstype(prism_physics_object)inPhysics (initialized).
file_parameterstype(file_ini)inoutSimulation parameters ini file handler.
rk_schemecharacter(len=*)inRunge-Kutta scheme (parsed by ts).
extra_fieldsinteger(kind=I4P)outCorrection to the block-sized fields per block.
reserved_memoryreal(kind=R8P)outMemory of the allocations not block-sized (GB).

Call graph

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 (default 1).

Call graph

initialize_pml_fnl ​

(Re)build the device PML twins (compact face storage) from the host PML and the faces' SELAH companions on the device arrays (#134 D5): at initialization and whenever the host PML is rebuilt on a new block set (issue #95, P5.1). Both initializers destroy their state first.

fortran
subroutine initialize_pml_fnl(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

amr_update ​

Do AMR update: the common host update (which rebuilds the per-block face data on a changed grid), then the device PML twins from the rebuilt host PML (issue #95, P5.1). The device fields and maps follow in initialize_forest.

fortran
subroutine amr_update(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

rebalance ​

Balance the static grid's blocks by count (issue #123): the common host rebalance (which rebuilds the per-block face data), then the device PML twins from the rebuilt host PML, as amr_update does. The device fields and maps follow in initialize_forest.

fortran
subroutine rebalance(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

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

register_pic_deposition_on_coils_dev ​

Device twin of prism_common_object%register_pic_deposition_on_coils: right after a PIC deposit into q_gpu, plasma current or charge on the coil support is no longer an error. The current is kept (committed or stage slot) and summed with the coil current by every later coil stamp of that state; the first occurrence is warned and repeated at the end of the run (report_plasma_on_coils). Collective (with coils): the overlap is reduced over the ranks and, when found, the ghosts of q_gpu are refreshed before the support (ghost cells included) is kept. Without overlap q_gpu is untouched.

fortran
subroutine register_pic_deposition_on_coils_dev(self, q_gpu, stage, check_current, check_charge, context)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
q_gpureal(kind=R8P)inoutDeposited field.
stagelogicalinq_gpu is a stage state (else the committed one).
check_currentlogicalinoptionalThe J rows hold a fresh deposit.
check_chargelogicalinoptionalThe charge row holds a fresh deposit.
contextcharacter(len=*)inoptionalCall-site label.

Call graph

mark_by_j_vec_total_variation ​

Mark blocks to be refined/derefined by the value of total variation of j_vec, FNL (device) backend.

Device twin of prism_cpu_object%mark_by_j_vec_total_variation. The TV reduction runs on the device, where j_vec_gpu lives: routing it through the host implementation would cost a full transposed D2H of the largest array in the run to produce one scalar per block. Only tv(1:blocks_number) crosses back, and the refinement decision stays on the host because the tree/AMR state is host-side anyway.

Contiguity discipline (adam_fnl_fdv_operators_library): the device operators take PRE-GATHERED contiguous 1D stencils, they never slice inside an acc routine seq. Hence the nine qs* buffers below, mirroring compute_curl_fd_dev_kernel. dxyz_b is a private copy for the same reason as issue #26 G1.b: the strided section dxyz_gpu(b,1:3) materializes a compiler temporary that is NOT privatized and threads race on it.

Two deliberate divergences from the host original, both behaviour-preserving today:

  1. The host reduces via realm_object%compute_block_total_variation, which is parameterised on ivar and reads components (ivar, ivar+1, ivar+2). The only call site passes ivar=1, so the kernel below gathers components 1..3 of j_vec directly rather than carrying an offset through nine stencil gathers. Restore the parameter here if a caller ever needs a vector field that does not start at component 1.
  2. tot_var_field is stamped into j_vec_tv_gpu (one field, allocated only with an AMR_TV marker, issue #112 C), which copy_gpu_cpu copies into the host divergence row 4 (totvar), the row the host marker fills.

j_vec_gpu ghosts are valid without any exchange: set_coil writes J_vec over the full ghosted extent (1-ngc:n+ngc) with explicit face-slab ghost reconstruction, and set_initial_conditions pushes it to device via copy_cpu_gpu immediately before every amr_update in the IC/AMR loop.

fortran
subroutine mark_by_j_vec_total_variation(self, tv_tol, delta_type, delta_fine, delta_coarse, threshold, do_init)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
tv_tolreal(kind=R8P)inTotal variation tolerance value.
delta_typecharacter(len=*)inDelta criterion type.
delta_finereal(kind=R8P)inMaximum cell delta in fine grids.
delta_coarsereal(kind=R8P)inMinimum cell delta in coarse grids.
thresholdreal(kind=R8P)inoptionalThreshold for sphere proximity.
do_initlogicalinoptionalRe-initialize refinements queries.

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

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 field of q.
ovarinteger(kind=I4P)inOutput index in div.
q_gpureal(kind=R8P)inField variables.
divergence_gpureal(kind=R8P)inoutDivergence.
maxdivreal(kind=R8P)outoptionalMax divergence, for checking.

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 field of q.
ovarinteger(kind=I4P)inOutput index in divergence.
q_gpureal(kind=R8P)inField variables.
divergence_gpureal(kind=R8P)inoutDivergence.
maxdivreal(kind=R8P)outoptionalMax divergence, for checking.

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, flux_register)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
q_gpureal(kind=R8P)inoutConservative variables.
dq_gpureal(kind=R8P)inoutResiduals.
sinteger(kind=I4P)inoptionalStage counter.
flux_registerclass(flux_register_object)inoutoptionalForest's flux register (interface parity; the FD path does not accumulate seam fluxes).

Call graph

apply_pml_fd_centered_ade_dev ​

Add ADE-PML source terms to the FD-centered Maxwell residuals and build the device-side auxiliary RHSs.

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

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inout
q_gpureal(kind=R8P)in
dq_gpureal(kind=R8P)inout
sinteger(kind=I4P)inoptional

Call graph

fd_centered_plain_dev_kernel ​

Centered-FD Maxwell residual without hyperbolic cleaning.

fortran
subroutine fd_centered_plain_dev_kernel(ni, nj, nk, ngc, blocks_number, var_jx, var_jy, var_jz, s1, inv_mu_scale, inv_eps_scale, dxyz_gpu, q_gpu, dq_gpu)

Arguments

NameTypeIntentAttributesDescription
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
ngcinteger(kind=I4P)in
blocks_numberinteger(kind=I4P)in
var_jxinteger(kind=I4P)in
var_jyinteger(kind=I4P)in
var_jzinteger(kind=I4P)in
s1integer(kind=I4P)in
inv_mu_scalereal(kind=R8P)in
inv_eps_scalereal(kind=R8P)in
dxyz_gpureal(kind=R8P)in
q_gpureal(kind=R8P)in
dq_gpureal(kind=R8P)inout

Call graph

fd_centered_phi_dev_kernel ​

Centered-FD Maxwell residual with phi cleaning only.

fortran
subroutine fd_centered_phi_dev_kernel(ni, nj, nk, ngc, blocks_number, var_jx, var_jy, var_jz, s1, inv_mu_scale, inv_eps_scale, chi_wave, alpha, ivar_phi, rho_ivar, use_rho, dxyz_gpu, q_gpu, dq_gpu)

Arguments

NameTypeIntentAttributesDescription
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
ngcinteger(kind=I4P)in
blocks_numberinteger(kind=I4P)in
var_jxinteger(kind=I4P)in
var_jyinteger(kind=I4P)in
var_jzinteger(kind=I4P)in
s1integer(kind=I4P)in
inv_mu_scalereal(kind=R8P)in
inv_eps_scalereal(kind=R8P)in
chi_wavereal(kind=R8P)in
alphareal(kind=R8P)in
ivar_phiinteger(kind=I4P)in
rho_ivarinteger(kind=I4P)in
use_rhointeger(kind=I4P)in
dxyz_gpureal(kind=R8P)in
q_gpureal(kind=R8P)in
dq_gpureal(kind=R8P)inout

Call graph

fd_centered_psi_dev_kernel ​

Centered-FD Maxwell residual with psi cleaning only.

fortran
subroutine fd_centered_psi_dev_kernel(ni, nj, nk, ngc, blocks_number, var_jx, var_jy, var_jz, s1, inv_mu_scale, inv_eps_scale, chi_wave, alpha, ivar_psi, dxyz_gpu, q_gpu, dq_gpu)

Arguments

NameTypeIntentAttributesDescription
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
ngcinteger(kind=I4P)in
blocks_numberinteger(kind=I4P)in
var_jxinteger(kind=I4P)in
var_jyinteger(kind=I4P)in
var_jzinteger(kind=I4P)in
s1integer(kind=I4P)in
inv_mu_scalereal(kind=R8P)in
inv_eps_scalereal(kind=R8P)in
chi_wavereal(kind=R8P)in
alphareal(kind=R8P)in
ivar_psiinteger(kind=I4P)in
dxyz_gpureal(kind=R8P)in
q_gpureal(kind=R8P)in
dq_gpureal(kind=R8P)inout

Call graph

fd_centered_phi_psi_dev_kernel ​

Centered-FD Maxwell residual with phi/psi cleaning.

fortran
subroutine fd_centered_phi_psi_dev_kernel(ni, nj, nk, ngc, blocks_number, var_jx, var_jy, var_jz, s1, inv_mu_scale, inv_eps_scale, chi_wave, alpha, ivar_phi, ivar_psi, rho_ivar, use_rho, dxyz_gpu, q_gpu, dq_gpu)

Arguments

NameTypeIntentAttributesDescription
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
ngcinteger(kind=I4P)in
blocks_numberinteger(kind=I4P)in
var_jxinteger(kind=I4P)in
var_jyinteger(kind=I4P)in
var_jzinteger(kind=I4P)in
s1integer(kind=I4P)in
inv_mu_scalereal(kind=R8P)in
inv_eps_scalereal(kind=R8P)in
chi_wavereal(kind=R8P)in
alphareal(kind=R8P)in
ivar_phiinteger(kind=I4P)in
ivar_psiinteger(kind=I4P)in
rho_ivarinteger(kind=I4P)in
use_rhointeger(kind=I4P)in
dxyz_gpureal(kind=R8P)in
q_gpureal(kind=R8P)in
dq_gpureal(kind=R8P)inout

Call graph

compute_residuals_fv_centered_dev ​

Compute residuals, space operator, centered finite volume scheme — FNL device backend (issue #23 R2). 1:1 structural mirror of prism_cpu_object%compute_residuals_fv_centered: ghost refresh on q, pointwise Maxwell fluxes at ALL cells (incl. ghosts) into flxyz_c_gpu, three staggered face-reconstruction sweeps into fl{x,y,z}_f_gpu (the m=0 SOTA primitive, already acc routine seq), flux difference + J source into dq_gpu. The Maxwell-flux variant is selected ONCE at host side, then a specialized device kernel runs with no per-cell variant branch. Inter-realm seam accumulation (issue #23 R3): after the face sweeps, at the realm's FINAL RK substage only (α.r1, CPU parity), the seam face skins are device-packed, D2H-copied (tiny slabs) and accumulated into the HOST-side flux register — see accumulate_seam_fluxes_fv_dev.

Race discipline (CLAUDE-gpu): the kernels below are MODULE-LEVEL procedures (not contained here) with constant-bound private gathers — the certified #22 F2/F3 pattern.

fortran
subroutine compute_residuals_fv_centered_dev(self, q_gpu, dq_gpu, s, flux_register)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
q_gpureal(kind=R8P)inoutConservative variables.
dq_gpureal(kind=R8P)inoutResiduals.
sinteger(kind=I4P)inoptionalStage counter (gates the seam-flux accumulation).
flux_registerclass(flux_register_object)inoutoptionalForest's flux register for FV seam reflux.

Call graph

fv_cell_fluxes_maxwell_dev_kernel ​

Pointwise plain dimensional Maxwell fluxes at every cell (incl. ghosts).

fortran
subroutine fv_cell_fluxes_maxwell_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, chi, q_gpu, flxyz_c_gpu)

Arguments

NameTypeIntentAttributesDescription
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
ngcinteger(kind=I4P)in
nv_cinteger(kind=I4P)in
blocks_numberinteger(kind=I4P)in
chireal(kind=R8P)in
q_gpureal(kind=R8P)in
flxyz_c_gpureal(kind=R8P)inout

Call graph

fv_cell_fluxes_maxwell_adim_dev_kernel ​

Pointwise plain adimensional Maxwell fluxes at every cell (incl. ghosts).

fortran
subroutine fv_cell_fluxes_maxwell_adim_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, chi, q_gpu, flxyz_c_gpu)

Arguments

NameTypeIntentAttributesDescription
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
ngcinteger(kind=I4P)in
nv_cinteger(kind=I4P)in
blocks_numberinteger(kind=I4P)in
chireal(kind=R8P)in
q_gpureal(kind=R8P)in
flxyz_c_gpureal(kind=R8P)inout

Call graph

fv_cell_fluxes_maxwell_div_d_dev_kernel ​

Pointwise dimensional Maxwell fluxes with D hyperbolic cleaning.

fortran
subroutine fv_cell_fluxes_maxwell_div_d_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, chi, q_gpu, flxyz_c_gpu)

Arguments

NameTypeIntentAttributesDescription
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
ngcinteger(kind=I4P)in
nv_cinteger(kind=I4P)in
blocks_numberinteger(kind=I4P)in
chireal(kind=R8P)in
q_gpureal(kind=R8P)in
flxyz_c_gpureal(kind=R8P)inout

Call graph

fv_cell_fluxes_maxwell_div_b_dev_kernel ​

Pointwise dimensional Maxwell fluxes with B hyperbolic cleaning.

fortran
subroutine fv_cell_fluxes_maxwell_div_b_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, chi, q_gpu, flxyz_c_gpu)

Arguments

NameTypeIntentAttributesDescription
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
ngcinteger(kind=I4P)in
nv_cinteger(kind=I4P)in
blocks_numberinteger(kind=I4P)in
chireal(kind=R8P)in
q_gpureal(kind=R8P)in
flxyz_c_gpureal(kind=R8P)inout

Call graph

fv_cell_fluxes_maxwell_div_d_b_dev_kernel ​

Pointwise dimensional Maxwell fluxes with D/B hyperbolic cleaning.

fortran
subroutine fv_cell_fluxes_maxwell_div_d_b_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, chi, q_gpu, flxyz_c_gpu)

Arguments

NameTypeIntentAttributesDescription
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
ngcinteger(kind=I4P)in
nv_cinteger(kind=I4P)in
blocks_numberinteger(kind=I4P)in
chireal(kind=R8P)in
q_gpureal(kind=R8P)in
flxyz_c_gpureal(kind=R8P)inout

Call graph

fv_cell_fluxes_maxwell_adim_div_d_dev_kernel ​

Pointwise adimensional Maxwell fluxes with D hyperbolic cleaning.

fortran
subroutine fv_cell_fluxes_maxwell_adim_div_d_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, chi, q_gpu, flxyz_c_gpu)

Arguments

NameTypeIntentAttributesDescription
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
ngcinteger(kind=I4P)in
nv_cinteger(kind=I4P)in
blocks_numberinteger(kind=I4P)in
chireal(kind=R8P)in
q_gpureal(kind=R8P)in
flxyz_c_gpureal(kind=R8P)inout

Call graph

fv_cell_fluxes_maxwell_adim_div_b_dev_kernel ​

Pointwise adimensional Maxwell fluxes with B hyperbolic cleaning.

fortran
subroutine fv_cell_fluxes_maxwell_adim_div_b_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, chi, q_gpu, flxyz_c_gpu)

Arguments

NameTypeIntentAttributesDescription
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
ngcinteger(kind=I4P)in
nv_cinteger(kind=I4P)in
blocks_numberinteger(kind=I4P)in
chireal(kind=R8P)in
q_gpureal(kind=R8P)in
flxyz_c_gpureal(kind=R8P)inout

Call graph

fv_cell_fluxes_maxwell_adim_div_d_b_dev_kernel ​

Pointwise adimensional Maxwell fluxes with D/B hyperbolic cleaning.

fortran
subroutine fv_cell_fluxes_maxwell_adim_div_d_b_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, chi, q_gpu, flxyz_c_gpu)

Arguments

NameTypeIntentAttributesDescription
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
ngcinteger(kind=I4P)in
nv_cinteger(kind=I4P)in
blocks_numberinteger(kind=I4P)in
chireal(kind=R8P)in
q_gpureal(kind=R8P)in
flxyz_c_gpureal(kind=R8P)inout

Call graph

fv_recon_x_dev_kernel ​

Reconstruct x-fluxes at x-faces from cell-center fluxes (issue #23 R2): per face i+1/2 (i = 0..ni), gather the 2*s1 cell-flux stencil into a constant-bound private buffer and call the m=0 SOTA face-reconstruction primitive (already acc routine seq).

fortran
subroutine fv_recon_x_dev_kernel(s1, ni, nj, nk, ngc, nv_c, blocks_number, flxyz_c_gpu, flx_f_gpu)

Arguments

NameTypeIntentAttributesDescription
s1integer(kind=I4P)inHalf FDV stencil length.
niinteger(kind=I4P)inGrids dimensions.
njinteger(kind=I4P)inGrids dimensions.
nkinteger(kind=I4P)inGrids dimensions.
ngcinteger(kind=I4P)inGrids dimensions.
nv_cinteger(kind=I4P)inConservative variables number.
blocks_numberinteger(kind=I4P)inGrids dimensions.
flxyz_c_gpureal(kind=R8P)inCell-center fluxes (b,1,d,i,j,k,v).
flx_f_gpureal(kind=R8P)inoutX-face fluxes (b,0:ni,j,k,v).

Call graph

fv_recon_y_dev_kernel ​

Reconstruct y-fluxes at y-faces (issue #23 R2); twin of fv_recon_x_dev_kernel.

fortran
subroutine fv_recon_y_dev_kernel(s1, ni, nj, nk, ngc, nv_c, blocks_number, flxyz_c_gpu, fly_f_gpu)

Arguments

NameTypeIntentAttributesDescription
s1integer(kind=I4P)inHalf FDV stencil length.
niinteger(kind=I4P)inGrids dimensions.
njinteger(kind=I4P)inGrids dimensions.
nkinteger(kind=I4P)inGrids dimensions.
ngcinteger(kind=I4P)inGrids dimensions.
nv_cinteger(kind=I4P)inConservative variables number.
blocks_numberinteger(kind=I4P)inGrids dimensions.
flxyz_c_gpureal(kind=R8P)inCell-center fluxes (b,1,d,i,j,k,v).
fly_f_gpureal(kind=R8P)inoutY-face fluxes (b,i,0:nj,k,v).

Call graph

fv_recon_z_dev_kernel ​

Reconstruct z-fluxes at z-faces (issue #23 R2); twin of fv_recon_x_dev_kernel.

fortran
subroutine fv_recon_z_dev_kernel(s1, ni, nj, nk, ngc, nv_c, blocks_number, flxyz_c_gpu, flz_f_gpu)

Arguments

NameTypeIntentAttributesDescription
s1integer(kind=I4P)inHalf FDV stencil length.
niinteger(kind=I4P)inGrids dimensions.
njinteger(kind=I4P)inGrids dimensions.
nkinteger(kind=I4P)inGrids dimensions.
ngcinteger(kind=I4P)inGrids dimensions.
nv_cinteger(kind=I4P)inConservative variables number.
blocks_numberinteger(kind=I4P)inGrids dimensions.
flxyz_c_gpureal(kind=R8P)inCell-center fluxes (b,1,d,i,j,k,v).
flz_f_gpureal(kind=R8P)inoutZ-face fluxes (b,i,j,0:nk,v).

Call graph

fv_flux_diff_plain_dev_kernel ​

Conservative flux difference + J source, no hyperbolic damping fields.

fortran
subroutine fv_flux_diff_plain_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, var_jx, var_jy, var_jz, dxyz_gpu, flx_f_gpu, fly_f_gpu, flz_f_gpu, q_gpu, dq_gpu)

Arguments

NameTypeIntentAttributesDescription
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
ngcinteger(kind=I4P)in
nv_cinteger(kind=I4P)in
blocks_numberinteger(kind=I4P)in
var_jxinteger(kind=I4P)in
var_jyinteger(kind=I4P)in
var_jzinteger(kind=I4P)in
dxyz_gpureal(kind=R8P)in
flx_f_gpureal(kind=R8P)in
fly_f_gpureal(kind=R8P)in
flz_f_gpureal(kind=R8P)in
q_gpureal(kind=R8P)in
dq_gpureal(kind=R8P)inout

Call graph

fv_flux_diff_phi_dev_kernel ​

Conservative flux difference + J source + phi damping.

fortran
subroutine fv_flux_diff_phi_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, var_jx, var_jy, var_jz, chi_wave, alpha, fv_ivar_phi, rho_ivar, use_rho, dxyz_gpu, flx_f_gpu, fly_f_gpu, flz_f_gpu, q_gpu, dq_gpu)

Arguments

NameTypeIntentAttributesDescription
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
ngcinteger(kind=I4P)in
nv_cinteger(kind=I4P)in
blocks_numberinteger(kind=I4P)in
var_jxinteger(kind=I4P)in
var_jyinteger(kind=I4P)in
var_jzinteger(kind=I4P)in
chi_wavereal(kind=R8P)in
alphareal(kind=R8P)in
fv_ivar_phiinteger(kind=I4P)in
rho_ivarinteger(kind=I4P)in
use_rhointeger(kind=I4P)in
dxyz_gpureal(kind=R8P)in
flx_f_gpureal(kind=R8P)in
fly_f_gpureal(kind=R8P)in
flz_f_gpureal(kind=R8P)in
q_gpureal(kind=R8P)in
dq_gpureal(kind=R8P)inout

Call graph

fv_flux_diff_psi_dev_kernel ​

Conservative flux difference + J source + psi damping.

fortran
subroutine fv_flux_diff_psi_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, var_jx, var_jy, var_jz, alpha, fv_ivar_psi, dxyz_gpu, flx_f_gpu, fly_f_gpu, flz_f_gpu, q_gpu, dq_gpu)

Arguments

NameTypeIntentAttributesDescription
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
ngcinteger(kind=I4P)in
nv_cinteger(kind=I4P)in
blocks_numberinteger(kind=I4P)in
var_jxinteger(kind=I4P)in
var_jyinteger(kind=I4P)in
var_jzinteger(kind=I4P)in
alphareal(kind=R8P)in
fv_ivar_psiinteger(kind=I4P)in
dxyz_gpureal(kind=R8P)in
flx_f_gpureal(kind=R8P)in
fly_f_gpureal(kind=R8P)in
flz_f_gpureal(kind=R8P)in
q_gpureal(kind=R8P)in
dq_gpureal(kind=R8P)inout

Call graph

fv_flux_diff_phi_psi_dev_kernel ​

Conservative flux difference + J source + phi/psi damping.

fortran
subroutine fv_flux_diff_phi_psi_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, var_jx, var_jy, var_jz, chi_wave, alpha, fv_ivar_phi, fv_ivar_psi, rho_ivar, use_rho, dxyz_gpu, flx_f_gpu, fly_f_gpu, flz_f_gpu, q_gpu, dq_gpu)

Arguments

NameTypeIntentAttributesDescription
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
ngcinteger(kind=I4P)in
nv_cinteger(kind=I4P)in
blocks_numberinteger(kind=I4P)in
var_jxinteger(kind=I4P)in
var_jyinteger(kind=I4P)in
var_jzinteger(kind=I4P)in
chi_wavereal(kind=R8P)in
alphareal(kind=R8P)in
fv_ivar_phiinteger(kind=I4P)in
fv_ivar_psiinteger(kind=I4P)in
rho_ivarinteger(kind=I4P)in
use_rhointeger(kind=I4P)in
dxyz_gpureal(kind=R8P)in
flx_f_gpureal(kind=R8P)in
fly_f_gpureal(kind=R8P)in
flz_f_gpureal(kind=R8P)in
q_gpureal(kind=R8P)in
dq_gpureal(kind=R8P)inout

Call graph

accumulate_seam_fluxes_fv_dev ​

Accumulate the FV seam face fluxes of one RK stage, weighted by its SSP coefficient weight = beta_s, into the forest's flux register — FNL twin of prism_cpu_object%accumulate_seam_fluxes_fv (issue #23 R3).

Register crossing (grilled R0 default): the flux register stays HOST-side. Per seam (block, fec) hit, a tiny device kernel packs the face skin into a contiguous device slab (inner axis fastest — the register's cell order), ONE D2H copy (~nv*nface_cells doubles, tens of KB per step) brings it to the host, and the shared register machinery does the rest: coarse side → accumulate_coarse_flux directly; fine side → quadrant offset from maps%amr_seam_quadrant (Morton-code precompute, issue #28 D2) + the pure 2:1 restriction restrict_fine_face_to_quadrant (moved to adam_flux_register_object, shared with the CPU backend) → accumulate_fine_flux. Fires at every RK stage, scaled by weight. Third-axis register index hardcoded to 1 (α.r1 collapsed register), exactly as on CPU.

fortran
subroutine accumulate_seam_fluxes_fv_dev(self, weight, flux_register)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe realm.
weightreal(kind=R8P)inStage weight, the SSP coefficient beta_s.
flux_registerclass(flux_register_object)inoutForest's flux register.

Call graph

fv_pack_face_skin_dev_kernel ​

Pack one block's face flux skin into a contiguous device slab (issue #23 R3): skin_gpu(c, v) with c = (outer-1)*inner_n + inner — the register cell order, identical to the CPU pack (pack_coarse_face / fine_face_cell mappings). Scalar element reads/writes only: no private arrays, no section actuals. The fec branch is uniform per launch (firstprivate scalar). Tiny kernel: one launch per seam (block, fec) hit, once per step.

fortran
subroutine fv_pack_face_skin_dev_kernel(fec, ni, nj, nk, nv_c, b, inner_n, outer_n, flx_f_gpu, fly_f_gpu, flz_f_gpu, skin_gpu)

Arguments

NameTypeIntentAttributesDescription
fecinteger(kind=I4P)inFace code 1..6 (-x,+x,-y,+y,-z,+z).
niinteger(kind=I4P)inInterior cell counts.
njinteger(kind=I4P)inInterior cell counts.
nkinteger(kind=I4P)inInterior cell counts.
nv_cinteger(kind=I4P)inConservative variables number.
binteger(kind=I4P)inBlock index.
inner_ninteger(kind=I4P)inTangential cell counts (inner fastest).
outer_ninteger(kind=I4P)inTangential cell counts (inner fastest).
flx_f_gpureal(kind=R8P)inX-face fluxes.
fly_f_gpureal(kind=R8P)inY-face fluxes.
flz_f_gpureal(kind=R8P)inZ-face fluxes.
skin_gpureal(kind=R8P)inoutPacked skin (inner_n*outer_n, nv_c).

Call graph

fv_apply_reflux_face_dev_kernel ​

Apply the Berger-Colella end-of-step correction for ONE register face to the committed q_gpu (issue #23 R4): per skin cell c (register cell order — the SAME (axis, sgn) → (i,j,k) mapping as the CPU apply), add scale * delta(v, c) to every state row. Scalar element ops only: no private arrays, no section actuals; each c writes a distinct cell (disjoint), the inner v loop is per-thread seq. Tiny kernel — one launch per face per step.

fortran
subroutine fv_apply_reflux_face_dev_kernel(axis, sgn, b, ni, nj, nk, ngc, nv_reg, nface_cells, scale, delta_gpu, q_gpu)

Arguments

NameTypeIntentAttributesDescription
axisinteger(kind=I4P)inFace normal axis (1..3) and sign (+-1).
sgninteger(kind=I4P)inFace normal axis (1..3) and sign (+-1).
binteger(kind=I4P)inCoarse block index.
niinteger(kind=I4P)inGrids dimensions.
njinteger(kind=I4P)inGrids dimensions.
nkinteger(kind=I4P)inGrids dimensions.
ngcinteger(kind=I4P)inGrids dimensions.
nv_reginteger(kind=I4P)inRegister state-vector width.
nface_cellsinteger(kind=I4P)inSkin cell count.
scalereal(kind=R8P)insign * dt / dx_coarse.
delta_gpureal(kind=R8P)inFlux mismatch slab (nv_reg, nface_cells).
q_gpureal(kind=R8P)inoutCommitted conservative variables.

Call graph

integrate_rk_ssp_pic ​

Integrate PIC equations with SSP RK on device: the field on SELAH's Butcher form (#132), the stage state the stepper's device register (the stage current is deposited into it, as into the former stage buffer).

fortran
subroutine integrate_rk_ssp_pic(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

gather_pic_fields_dev ​

Gather E and B at the particles into pic_fnl%pic_fields_gpu: the coherent gathers of totorica and esirkepov_Q<N> run in conserving_fnl (P^T on the virtual block, then the base shape), every other model is the pic_fnl gather. The neighbour list of q_pic_gpu must be current.

fortran
subroutine gather_pic_fields_dev(self, q_gpu, q_pic_gpu)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
q_gpureal(kind=R8P)inFields on device.
q_pic_gpureal(kind=R8P)inParticles on device.

Call graph

fold_deposited_ghosts_dev ​

Fold the PIC deposits that spilled into ghost cells back onto the cells they mirror, on this rank and across ranks, then refill the ghosts. CPU twin: prism_common_object%fold_deposited_ghosts. With one rank this is reduce_ghost_local_gpu alone. Collective: called even by a rank without particles (its deposits are zero).

fortran
subroutine fold_deposited_ghosts_dev(self, q_gpu, v_first, v_last)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
q_gpureal(kind=R8P)inoutField variables on device.
v_firstinteger(kind=I4P)inFirst variable to fold.
v_lastinteger(kind=I4P)inLast variable to fold.

Call graph

migrate_particles ​

Hand the particles that left the blocks of this rank to their new owners (end of a time step), then align the local particle counts of the device helpers. No-op with one rank.

fortran
subroutine migrate_particles(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

sync_particle_number ​

Copy the number of particles owned by this rank (host pic, after injection/distribution, restart or migration) into the device helpers, whose kernels loop on it. The particle arrays keep the capacity of the rank (issue #112).

fortran
subroutine sync_particle_number(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

integrate_rk_ssp_pic_charge_conserving ​

Integrate PIC equations with SSP RK and charge-conserving current reconstruction on device. CPU twin: prism_cpu_object%integrate_rk_ssp_pic_charge_conserving (same call sequence). The stage field is the RK stage buffer itself (the CPU copies it into q_stage, which is only read until assign_stage overwrites the buffer).

fortran
subroutine integrate_rk_ssp_pic_charge_conserving(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

initialize_pic_conserving_current_time_zero ​

Deposit rho (esirkepov_Q<N>) and the conserving current at t=0 on device, then return them to the host q. CPU twins: deposit_pic_modified_charge + initialize_pic_conserving_current_time_zero, called at the same point of set_initial_conditions (before the host-side elliptic solves that read rho and J).

fortran
subroutine initialize_pic_conserving_current_time_zero(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

pic_begin_step ​

Open the step of the particles' companion (#134 D5).

fortran
subroutine pic_begin_step(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

pic_begin_stage ​

Open stage k of the particles' companion: SELAH builds the particles' stage state, up (device).

fortran
subroutine pic_begin_stage(self, k, up)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
kinteger(kind=I4P)inStage.
upreal(kind=R8P)outpointerParticles' stage state.

Call graph

pic_residual ​

The particles' residual at their stage state, into the companion's register (device): x' = v, v' = (q/m) (E + v x B), the fields gathered at the stage positions (pic_fields_gpu, D scaled to E); charge and mass constant.

fortran
subroutine pic_residual(self, up)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
upreal(kind=R8P)inpointerParticles' stage state.

Call graph

pic_end_stage ​

Close stage k of the particles' companion, its residual written (pic_residual).

fortran
subroutine pic_end_stage(self, k)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
kinteger(kind=I4P)inStage.

Call graph

pic_finish_step ​

Close the step of the particles' companion: SELAH advances the particles (device).

fortran
subroutine pic_finish_step(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

pml_begin_step ​

Open the step of every PML face companion (#134 D5; nothing without an integrated PML).

fortran
subroutine pml_begin_step(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

pml_begin_stage ​

Open stage k of every PML face companion: SELAH builds the faces' stage states.

fortran
subroutine pml_begin_stage(self, k)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
kinteger(kind=I4P)inStage.

Call graph

pml_end_stage ​

Close stage k of every PML face companion, the residuals written by the stage's residual.

fortran
subroutine pml_end_stage(self, k)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
kinteger(kind=I4P)inStage.

Call graph

pml_finish_step ​

Close the step of every PML face companion: SELAH advances the device face arrays.

fortran
subroutine pml_finish_step(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

integrate_rk_ls_dev ​

Integrate equation, time operator, RK classical low storage schemes on the device: SELAH's two-register form (#132), every stage on q_gpu; the residual of each stage into dq_gpu (the residual log is stage 1's), copied into the stepper's residual register.

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 on the device: SELAH's Butcher form (#132), each stage state on the stepper's device register, its residual into dq_gpu, copied into the stepper's residual register (dq_gpu keeps the last stage's residual, as before: the step residual is not asked); the PML auxiliary fields advance in step on their own storage with the same tableau.

fortran
subroutine integrate_rk_ssp_dev(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

ts_begin_step ​

Open the stepper's step on q_gpu; the solid cells are masked with immersed solids.

fortran
subroutine ts_begin_step(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

ts_begin_stage ​

Open stage s of the stepper: its state; the solid cells are masked with immersed solids.

fortran
subroutine ts_begin_stage(self, s)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
sinteger(kind=I4P)inStage.

Call graph

ts_end_stage ​

Close stage s of the stepper (the two-register forms advance q_gpu here); masked with immersed solids.

fortran
subroutine ts_end_stage(self, s)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
sinteger(kind=I4P)inStage.

Call graph

ts_finish_step ​

Close the stepper's step: the Butcher form advances q_gpu (no step residual: dq_gpu keeps the last stage's residual, as the former device update_q left it).

fortran
subroutine ts_finish_step(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

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

initialize_process_context ​

Initialize the process context once (the forest calls it before any realm, #80 P3): the FNL handler (device binding, ranks sharing the device) first, since it may also be the MPI init, then the CPU handler.

fortran
subroutine initialize_process_context(self, verbose)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation (carries no MPI state).
verboselogicalinoptionalTrigger verbose output.

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_app_forest ​

Template hook: the PRISM backend (common data, dispatch, backend data).

fortran
subroutine initialize_app_forest(self, filename, realms_number)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe realm.
filenamecharacter(len=*)inInput parameters file name.
realms_numberinteger(kind=I4P)inoptionalRealm count; divides the budget.

Call graph

restart_state_forest ​

Template hook: the state from the restart files, then the coils and the t0 state on it.

fortran
subroutine restart_state_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe realm.

Call graph

set_initial_state_forest ​

Template hook: the initial conditions on the current grid (and the coils, the t0 solves).

fortran
subroutine set_initial_state_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe realm.

Call graph

post_initial_state_forest ​

Template hook: the ghost update, the t0 diagnostics, the history files.

fortran
subroutine post_initial_state_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe realm.

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: ts_begin_stage(self, s=k): SELAH builds the device stage state of k from the previous stages and self%q_gpu, and this 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.
realmtype(realm_pointer)inouttarget, optionalSibling realms (contract parity).

Call graph

seam_ghosts_to_state ​

Copy the ghosts of q_gpu of the end_of_step seams into the stepper's stage state (#132 rule 1, #116): the stage reads the peer state of the last exchange (the device twin of adam_seam_exchange%seam_ghosts_to_state).

fortran
subroutine seam_ghosts_to_state(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe realm.

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 the stage state of 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 the stage's residual write no longer races with peer reads.

realm accepted on contract for parity but unused: the seam has already been refreshed by the forest. FV seam-flux ACCUMULATION is threaded through flux_register (issue #23 R3, CPU parity); the reflux APPLICATION (apply_reflux_to_stage_forest) remains a no-op until #23 R4.

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.
realmtype(realm_pointer)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

pack_seam_cells_forest ​

Pack the ghost values of the seam send rows of peer slot p_idx from the active device buffer (q_gpu when stage_active == 0, else the active stage state) into the host buf, nv values per row: cell copies, or the 2:1 interpolations and restrictions of a refined seam (issues #40, #52).

fortran
subroutine pack_seam_cells_forest(self, p_idx, buf)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe realm.
p_idxinteger(kind=I4P)inPeer slot (the realm owning the ghosts).
bufreal(kind=R8P)outPacked values.

Call graph

unpack_seam_cells_forest ​

Unpack the host buf into this realm's seam ghosts of the cross-rank receive rows of peer slot p_idx, on the active device buffer, nv values per row (issue #40).

fortran
subroutine unpack_seam_cells_forest(self, p_idx, buf)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe realm.
p_idxinteger(kind=I4P)inPeer slot (the realm owning the cells).
bufreal(kind=R8P)inPacked values.

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 — the apply twin of prism_cpu_object%apply_reflux_to_stage_forest (issue #23 R4, M4 semantics).

α.r1 cadence: end-of-step barrier. Fires exactly once per realm per step at stage == self%ts%stages(); earlier substages return immediately. For each register face whose coarse side this realm — and this RANK (#28 D4) — owns, the correction sign*(dt/dx_coarse)*(F_coarse − F_fine_sum)(:,:,1) is applied to the COMMITTED q_gpu on the one-cell-thick coarse seam skin (this TBP runs AFTER close_step_forest's update_q). Full step weight dt/dx — NOT a stage RK coefficient, and NOT a q_rk_gpu(...,stage) write (both were the pre-M4 sketch's errors: ark is never allocated for the SSP family, and a stage-buffer write would entangle the stage beta weight — see the CPU apply's M4 note). The tiny host mismatch slab is H2D-copied per face and fv_apply_reflux_face_dev_kernel adds it to q_gpu (scalar ops only, disjoint cells).

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.
realmtype(realm_pointer)inouttarget, optionalSibling realms for inter-realm halo refresh.

Call graph

compute_plasma_frequencies ​

Maxima of the plasma frequencies over the cells and the particles (collective): they limit the next PIC step. particles (Omega_c, transit: q_pic, pic_fields and the particle-cell map aligned, before the end-of-step wrap and migration) and cells (omega_p and the composite frequencies: the map of the final positions), both by default (issue #129, R7).

fortran
subroutine compute_plasma_frequencies(self, particles, cells)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.
particleslogicalinoptionalParticle terms (default true).
cellslogicalinoptionalCell term (default true).

Call graph

locate_particles_end_of_step ​

The particle-cell map of the final positions, after the end-of-step wrap and migration (issue #129, R7): the omega_p limit of the next step reads it, and the restart rebuilds the same. Only when they moved or reordered the particles: more than one rank or a periodic face.

fortran
subroutine locate_particles_end_of_step(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

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

initialize_charge_conservation_diagnostic ​

Initialize rho_n/dt + sum_s beta_s div(J_s) diagnostic accumulator.

fortran
subroutine initialize_charge_conservation_diagnostic(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

accumulate_charge_conservation_current ​

Accumulate beta_s div(J_s) for the current PIC RK stage.

fortran
subroutine accumulate_charge_conservation_current(self, q_gpu, weight, s)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inout
q_gpureal(kind=R8P)inout
weightreal(kind=R8P)in
sinteger(kind=I4P)in

Call graph

finalize_charge_conservation_diagnostic ​

Finalize max |(rho_np1-rho_n)/dt + sum_s beta_s div(J_s)|.

fortran
subroutine finalize_charge_conservation_diagnostic(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inout

Call graph

save_charge_conservation_diagnostic ​

Save the 12-column PIC charge-conservation diagnostic for the current completed step.

fortran
subroutine save_charge_conservation_diagnostic(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inout

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_grms ​

Compute the RMS gradient of the rotating magnetic-field amplitude over the selected domain and over its -3 dB subset.

fortran
subroutine compute_grms(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inout

Call graph

sample_probes ​

Sample the fields at the probes on the device; only the local sums reach the host.

fortran
subroutine sample_probes(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

sync_probes ​

Copy the probe stencils, just built on the host, to the device.

fortran
subroutine sync_probes(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

compute_magnetic_field_at_center_domain ​

Compute the magnetic field interpolated at the geometrical domain center.

fortran
subroutine compute_magnetic_field_at_center_domain(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inout

Call graph

compute_max_divergence_outside_absorbing_layers ​

Host divergence maxima excluding ghost cells, absorbing layers and any cell whose centered-divergence stencil intersects them, from the host divergence array. CPU twin of the same name (prism_cpu_object); the device counterpart used during the run is compute_max_divergence.

fortran
subroutine compute_max_divergence_outside_absorbing_layers(self, hs, max_div_D, max_div_B, max_div_J)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe equation.
hsinteger(kind=I4P)inHalf stencil of the divergence operator.
max_div_Dreal(kind=R8P)outMax |div(D)| (|div(D)-rho| for PIC).
max_div_Breal(kind=R8P)outMax |div(B)|.
max_div_Jreal(kind=R8P)outMax |div(J)|.

Call graph

compute_max_divergence ​

Compute maximum divergence.

fortran
subroutine compute_max_divergence(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inoutThe equation.

Call graph

Functions ​

has_tv_marker ​

True if an AMR marker is the coil total variation (AMR_TV, mark_by_j_vec_total_variation), the only user of j_vec_tv_gpu.

Attributes: pure

Returns: logical

fortran
function has_tv_marker(amr) result(has)

Arguments

NameTypeIntentAttributesDescription
amrtype(amr_object)inAMR markers.

Call graph

pic_box ​

The particles' companion box: the active particles, every component (q_pic_gpu(capacity, 8)).

Returns: type(box)

fortran
function pic_box(self) result(bx)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe equation.

Call graph

stages_per_step_forest ​

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

SSP-only contract, twin of prism_cpu_object%stages_per_step_forest (issue #25): the staged protocol reads gamm(k) per stage and beta_gpu in close_step_forest — for low-storage schemes those are never allocated (the FNL symptom was CUDA_ERROR_ILLEGAL_ADDRESS in rk_update_q_dev through a bogus beta_gpu). Refusing here leaves the fused fast path — where LS schemes legitimately run — untouched.

Returns: integer(kind=I4P)

fortran
function stages_per_step_forest(self) result(K)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_fnl_object)inThe realm.

Call graph