Skip to content

adam_prism_cpu_object ​

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

Source: src/app/prism/cpu/adam_prism_cpu_object.F90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
compute_fluxes_maxwellprocedure(compute_convective_fluxes_interface)pointerCompute convective fluxes.
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
GRMS_3DB_RATIOreal(kind=R8P)parameter

Derived Types ​

prism_cpu_object ​

Maxwell equations system class definition, CPU 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.
flxyz_creal(kind=R8P)allocatableFluxes at cell center with +/- decomposition for all directions.
flx_freal(kind=R8P)allocatableFluxes along x at cell face.
fly_freal(kind=R8P)allocatableFluxes along y at cell face.
flz_freal(kind=R8P)allocatableFluxes along z at cell face.
charge_conservation_accreal(kind=R8P)allocatableAccumulator for rho/dt + weighted div(J) diagnostic.
charge_conservation_divjreal(kind=R8P)allocatableWorkspace for stage div(J) diagnostic.
londrillo_current_matrix_xreal(kind=R8P)allocatableCached factored x-line matrices for the londrillo PIC current.
londrillo_current_matrix_yreal(kind=R8P)allocatableCached factored y-line matrices for the londrillo PIC current.
londrillo_current_matrix_zreal(kind=R8P)allocatableCached factored z-line matrices for the londrillo PIC current.
londrillo_current_pivot_xinteger(kind=I4P)allocatableCached x-line pivots for the londrillo PIC current.
londrillo_current_pivot_yinteger(kind=I4P)allocatableCached y-line pivots for the londrillo PIC current.
londrillo_current_pivot_zinteger(kind=I4P)allocatableCached z-line pivots for the londrillo PIC current.
londrillo_current_cache_niinteger(kind=I4P)Cached x-line size.
londrillo_current_cache_njinteger(kind=I4P)Cached y-line size.
londrillo_current_cache_nkinteger(kind=I4P)Cached z-line size.
londrillo_current_cache_nbinteger(kind=I4P)Cached block count.
londrillo_current_cache_hsinteger(kind=I4P)Cached half-stencil.
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.
charge_conservation_error_maxreal(kind=R8P)Max continuity-equation residual over one PIC step.
current_solver_residual_maxreal(kind=R8P)Max residual of the direct current line solves.
charge_conservation_readylogicalTrue when the current PIC step has a finalized diagnostic.
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. Pointer (abstract) TBP.
compute_residualsprocedure(compute_residuals_interface)pass(self), pointerCompute residuals, space operator.
integrateprocedure(integrate_interface)pass(self), pointerIntegrate, time operator.

Type-Bound Procedures

NameAttributesDescription
load_fdv_from_filepass(self)Load FDV config from file.
initialize_process_contextpass(self)Process-global MPI (+ device) init; forest calls it ONCE first.
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).
finalize_mpi_forestpass(self)Process-global MPI finalize; forest calls it ONCE after all.
after_topology_build_forestpass(self)Backend hook invoked once after the forest builds the seam maps.
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_updatepass(self)Do AMR update (init-time only where amr_locked_).
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.
rebalancepass(self)Balance the static grid's blocks by count (issue #123).
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.
load_restart_filespass(self)Load restart files.
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.
sample_probespass(self)Sample the fields at the probes (backend override).
sync_probespass(self)Sync the probe stencils with the backend (backend override).
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.
mark_by_j_vec_total_variationpass(self)Mark blocks to be refined/derefined by the value of total variation of j_vec.
allocate_cpupass(self)Allocate CPU data.
initialize_prismpass(self)Initialize PRSIM equation.
save_residualspass(self)Save residuals history.
save_simulation_datapass(self)Save all simulation data.
apply_fWL_correctionpass(self)Apply fWLayer correction (if present)
compute_coils_currentpass(self)Compute current coils sources.
set_boundary_conditionspass(self)Set boundary conditions of equation.
set_initial_conditionspass(self)Set initial conditions (and coils) of equation.
update_ghostpass(self)Update ghost cells and set boundary conditions.
compute_field_mean_valuepass(self)Compute field mean value.
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.
fill_seam_from_peer_forestpass(self)Copy peer's interior into self's ghosts for peer slot p_idx.
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.
apply_reflux_to_stage_forestpass(self)Apply end-of-step Berger-Colella reflux to self's committed q.
initialize_charge_conservation_diagnosticpass(self)Initialize PIC continuity-equation diagnostic.
accumulate_charge_conservation_currentpass(self)Accumulate weighted stage div(J).
finalize_charge_conservation_diagnosticpass(self)Finalize PIC continuity-equation diagnostic.
save_charge_conservation_diagnosticpass(self)Save PIC charge-conservation diagnostic history.
compute_dtpass(self)Compute time step.
compute_plasma_frequenciespass(self)Plasma frequencies limiting the next PIC step.
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.
simulatepass(self)Perform the simulation.

prism_cpu_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_cpu_object%initialize_process_context ​

Initialize the process-global MPI handler (and the device, on the device backends).

MPI and the device context are process-global: the forest calls this ONCE, on a single realm, before any realm is initialized (issue #80 P3, the mirror of finalize_mpi_forest); a realm never initializes them itself. The default initializes the CPU mpih singleton; the FNL backends override it to initialize mpih_fnl (device binding, the ranks sharing a device) first. mpih%initialize is once-only, so a test driver that called it already is harmless.

fortran
subroutine initialize_process_context(self, verbose)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm (carries no MPI state; dispatch picks the backend).
verboselogicalinoptionalTrigger verbose output.

Call graph

prism_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_object%finalize_mpi_forest ​

Finalize the process-global MPI handler.

MPI_FINALIZE is process-global and must run EXACTLY ONCE, after every realm has completed all MPI-using teardown. The forest therefore calls this on a SINGLE realm after the per-realm finalize_forest loop — not inside finalize_forest (which runs per realm; doing the finalize there tore MPI down while later realms still had IO/ghost work pending — the next realm's update_ghost would hit MPI_Type_f2c on a finalized communicator). The default targets the CPU mpih singleton; the FNL backend overrides to finalize mpih_fnl.

fortran
subroutine finalize_mpi_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm (carries no MPI state; dispatch picks the backend handler).

Call graph

prism_cpu_object%after_topology_build_forest ​

Backend hook invoked by forest%populate_inter_realm_topology AFTER all host-side seam maps have been built. CPU default is a no-op (host maps are the production state). GPU backends override to propagate the freshly-built host seam maps to device-resident copies (e.g. via maps_fnl%copy_cpu_gpu).

fortran
subroutine after_topology_build_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inout

Call graph

prism_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_object%amr_update ​

Do AMR update.

fortran
subroutine amr_update(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_cpu_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_cpu_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_cpu_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_cpu_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_cpu_object%rebalance ​

Balance the blocks over the ranks by count, complete sibling sets split (issue #123), after the initial AMR. PRISM regrids at initialization only (amr_locked_), so its grid is never derefined afterwards. The per-block data are rebuilt as amr_update rebuilds them after a grid change; the caller imposes the initial conditions (and the device copies) after it.

fortran
subroutine rebalance(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_cpu_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_cpu_object%allocate_common ​

Allocate common data.

fortran
subroutine allocate_common(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_cpu_object%compute_auxiliary_fields ​

Compute auxiliary fields.

fortran
subroutine compute_auxiliary_fields(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_object%load_restart_files ​

Save restart files.

fortran
subroutine load_restart_files(self, t, time)

Arguments

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

Call graph

prism_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_object%sample_probes ​

Sample the fields at the probes: local sums of the host q (CPU); a device backend overrides it.

fortran
subroutine sample_probes(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_cpu_object%sync_probes ​

Sync the probe stencils with the backend after they are built: nothing on the host; a device backend overrides it.

fortran
subroutine sync_probes(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_cpu_object%save_restart_files ​

Save restart files.

fortran
subroutine save_restart_files(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_cpu_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_cpu_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_cpu_object%initialize_coils ​

Initialize coils.

fortran
subroutine initialize_coils(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_common_object)inoutThe equation.

Call graph

prism_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_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

Interfaces ​

compute_residuals_interface ​

integrate_interface ​

Subroutines ​

mark_by_j_vec_total_variation ​

Mark blocks to be refined/derefined by the value of total variation of j_vec.

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

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_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

allocate_cpu ​

Allocate CPU data.

fortran
subroutine allocate_cpu(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

initialize_prism ​

Initialize PRSIM equation.

fortran
subroutine initialize_prism(self, filename, realms_number)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.
filenamecharacter(len=*)inInput file name.
realms_numberinteger(kind=I4P)inoptionalForest realm count; divides the per-process budget (default 1).

Call graph

save_residuals ​

Save residuals history.

fortran
subroutine save_residuals(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

save_simulation_data ​

Save all simulation data.

fortran
subroutine save_simulation_data(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

compute_coils_current ​

Compute current coils sources (DC/AC with smooth envelope).

fortran
subroutine compute_coils_current(self, q, gamma)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inout
qreal(kind=R8P)inout
gammareal(kind=R8P)inoptional

Call graph

apply_fWL_correction ​

Apply correction if a fWL is present

fortran
subroutine apply_fWL_correction(self, q)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.
qreal(kind=R8P)inoutConservative variables.

Call graph

set_boundary_conditions ​

Set boundary conditions of equation.

fortran
subroutine set_boundary_conditions(self, q, s)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.
qreal(kind=R8P)inoutConservative variables.
sinteger(kind=I4P)inoptionalStage counter.

Call graph

compute_face_mirror_indexes ​

Return the donor indexes mirrored across the selected boundary face.

fortran
subroutine compute_face_mirror_indexes(face, ni, nj, nk, i_gc, j_gc, k_gc, idelta, jdelta, kdelta, i_d, j_d, k_d)

Arguments

NameTypeIntentAttributesDescription
faceinteger(kind=I4P)inFace index in 1:6 numbering.
niinteger(kind=I4P)inGrid dimensions.
njinteger(kind=I4P)inGrid dimensions.
nkinteger(kind=I4P)inGrid dimensions.
i_gcinteger(kind=I4P)inGhost-cell indexes.
j_gcinteger(kind=I4P)inGhost-cell indexes.
k_gcinteger(kind=I4P)inGhost-cell indexes.
ideltainteger(kind=I4P)inOne-step inward deltas.
jdeltainteger(kind=I4P)inOne-step inward deltas.
kdeltainteger(kind=I4P)inOne-step inward deltas.
i_dinteger(kind=I4P)outMirrored donor indexes.
j_dinteger(kind=I4P)outMirrored donor indexes.
k_dinteger(kind=I4P)outMirrored donor indexes.

Call graph

enforce_silver_muller_normal_bc_cpu ​

fortran
subroutine enforce_silver_muller_normal_bc_cpu(self, q)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
qreal(kind=R8P)inout

Call graph

solve_silver_muller_normal_line_cpu ​

fortran
subroutine solve_silver_muller_normal_line_cpu(q, ngc, ni, nj, nk, b, face, i_seed, j_seed, k_seed, hs, dxyz, has_rho, var_rho)

Arguments

NameTypeIntentAttributesDescription
qreal(kind=R8P)inout
ngcinteger(kind=I4P)in
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
binteger(kind=I4P)in
faceinteger(kind=I4P)in
i_seedinteger(kind=I4P)in
j_seedinteger(kind=I4P)in
k_seedinteger(kind=I4P)in
hsinteger(kind=I4P)in
dxyzreal(kind=R8P)in
has_rhologicalin
var_rhointeger(kind=I4P)in

Call graph

silver_muller_face_metadata_cpu ​

fortran
subroutine silver_muller_face_metadata_cpu(face, dir_t1, dir_t2, var_d_t1, var_d_t2, var_d_n, var_b_t1, var_b_t2, var_b_n)

Arguments

NameTypeIntentAttributesDescription
faceinteger(kind=I4P)in
dir_t1integer(kind=I4P)out
dir_t2integer(kind=I4P)out
var_d_t1integer(kind=I4P)out
var_d_t2integer(kind=I4P)out
var_d_ninteger(kind=I4P)out
var_b_t1integer(kind=I4P)out
var_b_t2integer(kind=I4P)out
var_b_ninteger(kind=I4P)out

Call graph

solve_silver_muller_normal_field_cpu ​

fortran
subroutine solve_silver_muller_normal_field_cpu(q, ngc, ni, nj, nk, b, face, i_seed, j_seed, k_seed, hs, dxyz, dir_t1, dir_t2, var_t1, var_t2, var_n, use_target_var, target_var)

Arguments

NameTypeIntentAttributesDescription
qreal(kind=R8P)inout
ngcinteger(kind=I4P)in
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
binteger(kind=I4P)in
faceinteger(kind=I4P)in
i_seedinteger(kind=I4P)in
j_seedinteger(kind=I4P)in
k_seedinteger(kind=I4P)in
hsinteger(kind=I4P)in
dxyzreal(kind=R8P)in
dir_t1integer(kind=I4P)in
dir_t2integer(kind=I4P)in
var_t1integer(kind=I4P)in
var_t2integer(kind=I4P)in
var_ninteger(kind=I4P)in
use_target_varlogicalin
target_varinteger(kind=I4P)in

Call graph

interior_cell_from_face_cpu ​

fortran
subroutine interior_cell_from_face_cpu(face, eq, ni, nj, nk, i_seed, j_seed, k_seed, ic, jc, kc)

Arguments

NameTypeIntentAttributesDescription
faceinteger(kind=I4P)in
eqinteger(kind=I4P)in
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
i_seedinteger(kind=I4P)in
j_seedinteger(kind=I4P)in
k_seedinteger(kind=I4P)in
icinteger(kind=I4P)out
jcinteger(kind=I4P)out
kcinteger(kind=I4P)out

Call graph

ghost_cell_from_face_cpu ​

fortran
subroutine ghost_cell_from_face_cpu(face, ghost_layer, ni, nj, nk, i_seed, j_seed, k_seed, ic, jc, kc)

Arguments

NameTypeIntentAttributesDescription
faceinteger(kind=I4P)in
ghost_layerinteger(kind=I4P)in
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
i_seedinteger(kind=I4P)in
j_seedinteger(kind=I4P)in
k_seedinteger(kind=I4P)in
icinteger(kind=I4P)out
jcinteger(kind=I4P)out
kcinteger(kind=I4P)out

Call graph

set_initial_conditions ​

Set initial conditions and coils on field.

fortran
subroutine set_initial_conditions(self, is_restart)

Arguments

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

Call graph

update_ghost ​

Update ghost cells (intra-realm only). If not specified all steps are performed, synchronous computation.

Inter-realm seam ghost cells are NO LONGER filled here: the forest's Phase 2 seam fill (between begin_stage and end_stage) populates them via the fill_seam_from_peer_forest TBP operating on the realm's currently-active buffer (selected internally via stage_active). The realm(:) optional dummy that used to thread through this signature has been retired.

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

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.
qreal(kind=R8P)inoutConservative variables.
stepinteger(kind=I4P)inoptionalStep to be perfordmed in asyncronous comp.
sinteger(kind=I4P)inoptionalStage counter.

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_cpu_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_cpu_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_cpu_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_cpu_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.

fortran
subroutine compute_local_dt_forest(self, dt_local)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_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_cpu_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, open the stepper's step.

Mirrors the head of integrate_rk_ssp: ts_begin_step and the PML companions' pml_begin_step, 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_cpu_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.

Mirrors the FIRST line of integrate_rk_ssp's substage body: ts_begin_stage(self, s=k). SELAH builds the stage state of k from the previous stages and self%q, 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_cpu_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

end_stage_forest ​

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

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

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_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).
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.

Mirrors the post-substage tail of integrate_rk_ssp: ts%finish_step + save_residuals + compute_coils_current + external_fields add, plus the post-loop time advance + progress print that advance_one_step_forest does inline.

fortran
subroutine close_step_forest(self, dt)

Arguments

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

Call graph

fill_seam_from_peer_forest ​

Fill THIS realm's seam ghost cells for peer slot p_idx from peer's interior cells. Single-TBP roundtrip: walks the receiver's sorted seam-map slice for the peer, and for each row copies peer's INTERIOR(b_send, i_send, j_send, k_send, v) → self's GHOST (b_recv, i_recv, j_recv, k_recv, v) on the active conservative buffer (q when stage_active == 0, or the stepper's stage state when active). The PEER's stage_active controls its read source; SELF's stage_active controls its write target.

select type(peer) is confined here — the only place that needs to know the peer's concrete backend type. Cross-backend mixing (CPU realm reading from FNL peer) is not supported and triggers error_stop.

fortran
subroutine fill_seam_from_peer_forest(self, peer, p_idx)

Arguments

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

Call graph

pack_seam_cells_forest ​

Pack the ghost values of the cross-rank seam send rows of peer slot p_idx from the active buffer (q when stage_active == 0, else the active stage state): cell copies, or the 2:1 interpolations and restrictions of a refined seam (issues #40, #52; adam_seam_exchange%pack_seam_rows).

fortran
subroutine pack_seam_cells_forest(self, p_idx, buf)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_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 buf into this realm's seam ghosts of the cross-rank receive rows of peer slot p_idx, on the active buffer (issue #40; adam_seam_exchange%unpack_seam_rows).

fortran
subroutine unpack_seam_cells_forest(self, p_idx, buf)

Arguments

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

Call graph

apply_reflux_to_stage_forest ​

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

α.r1 cadence: end-of-step barrier. The body fires exactly once per realm per step, at stage == self%ts%stages() (the realm's own final RK substage). Earlier stages return immediately as a no-op. The accumulators F_coarse(:,:,1) / F_fine_sum(:,:,1) hold the step flux sum_s beta_s F_s of each side (accumulate_seam_fluxes_fv fires at every stage, weighted by beta_s), i.e. the flux each side's committed update used, so the correction restores conservation to round-off; same-K and asymmetric-K realms alike, each side summing its own beta. This is the AMReX non-subcycled Reflux cadence.

For each face in flux_register where face%coarse_realm == self%realm_index, writes the per-cell correction to the committed q (after close_step_forest) q(:, seam_cell, b_coarse) += sign * (dt / dx_coarse) * (F_coarse(:,:,1) - F_fine_sum(:,:,1)) on the matching one-cell-thick seam slice (i ∈ {1, ni} for x-normal faces, etc.). The third-axis index is hardcoded to 1 under α.r1 (register collapsed by M2); the stage parameter is retained on the signature for API stability and used only for the cadence gate.

Empty-register / out-of-range guards short-circuit to a no-op, so a realm with no seam faces returns cleanly.

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

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_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-CPU's per-timestep post-step work: state IO, energy diagnostics, 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).

realm is accepted on contract parity with FNL; unused on CPU.

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_cpu_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.

Call graph

is_done_forest ​

Decide whether this realm has reached its local termination criterion.

Invoked by forest%is_done. PRISM-CPU 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_cpu_object)inThe realm.
donelogicaloutTrue if this realm is done evolving.

Call graph

finalize_forest ​

Shut this realm down: final state dump, close residuals/energy/ divergence history files, post-loop divergence diagnostics, finalize MPI handler.

Invoked by forest%finalize. v1 implementation is the verbatim post- loop block formerly inline in simulate. Behavior unchanged.

fortran
subroutine finalize_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe realm.

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 will perform 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_cpu_object)inoutThe equation.

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_cpu_object)inoutThe equation.
particleslogicalinoptionalParticle terms (default true).
cellslogicalinoptionalCell term (default true).

Call graph

compute_energy ​

Compute energy.

fortran
subroutine compute_energy(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

compute_energy_error ​

Compute energy error.

fortran
subroutine compute_energy_error(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_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_cpu_object)inout

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_cpu_object)inout

Call graph

compute_max_divergence_outside_absorbing_layers ​

Compute divergence maxima excluding absorbing layers and any cell whose centered-divergence stencil intersects them.

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

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
hsinteger(kind=I4P)in
max_div_Dreal(kind=R8P)out
max_div_Breal(kind=R8P)out
max_div_Jreal(kind=R8P)out

Call graph

exclude_stencil_contaminated_face ​

Shrink a 1D diagnostic window so that no retained cell uses a centered divergence stencil intersecting the selected absorbing layer face.

Attributes: pure

fortran
subroutine exclude_stencil_contaminated_face(lo, hi, face_first, face_last, is_minus, hs)

Arguments

NameTypeIntentAttributesDescription
lointeger(kind=I4P)inout
hiinteger(kind=I4P)inout
face_firstinteger(kind=I4P)in
face_lastinteger(kind=I4P)in
is_minuslogicalin
hsinteger(kind=I4P)in

Call graph

simulate ​

Perform the simulation: legacy single-realm entry point.

fortran
subroutine simulate(self, filename)

Arguments

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

Call graph

compute_residuals_fd_centered ​

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

fortran
subroutine compute_residuals_fd_centered(self, q, dq, s, flux_register)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.
qreal(kind=R8P)inoutConservative variables.
dqreal(kind=R8P)inoutResiduals.
sinteger(kind=I4P)inoptionalStage counter.
flux_registerclass(flux_register_object)inoutoptionalFlux register.

Call graph

apply_pml_fd_centered_ade ​

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

fortran
subroutine apply_pml_fd_centered_ade(self, q, dq, s)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inout
qreal(kind=R8P)in
dqreal(kind=R8P)inout
sinteger(kind=I4P)inoptional

Call graph

apply_direct_damping ​

Apply diagnostic direct damping on components transverse to the selected PML normal.

fortran
subroutine apply_direct_damping(self, q, dq, block_ids, face)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
qreal(kind=R8P)in
dqreal(kind=R8P)inout
block_idsinteger(kind=I4P)in
faceinteger(kind=I4P)in

Call graph

select_pml_field_scales ​

Convert D/B derivatives into E/H derivatives for the current physical scaling.

fortran
subroutine select_pml_field_scales(self, inv_eps_scale, inv_mu_scale)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
inv_eps_scalereal(kind=R8P)out
inv_mu_scalereal(kind=R8P)out

Call graph

apply_x_face_field_correction ​

fortran
subroutine apply_x_face_field_correction(self, q, q_face, dq, block_ids, face, inv_eps_scale, inv_mu_scale)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
qreal(kind=R8P)in
q_facereal(kind=R8P)in
dqreal(kind=R8P)inout
block_idsinteger(kind=I4P)in
faceinteger(kind=I4P)in
inv_eps_scalereal(kind=R8P)in
inv_mu_scalereal(kind=R8P)in

Call graph

apply_y_face_field_correction ​

fortran
subroutine apply_y_face_field_correction(self, q, q_face, dq, block_ids, face, inv_eps_scale, inv_mu_scale)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
qreal(kind=R8P)in
q_facereal(kind=R8P)in
dqreal(kind=R8P)inout
block_idsinteger(kind=I4P)in
faceinteger(kind=I4P)in
inv_eps_scalereal(kind=R8P)in
inv_mu_scalereal(kind=R8P)in

Call graph

apply_z_face_field_correction ​

fortran
subroutine apply_z_face_field_correction(self, q, q_face, dq, block_ids, face, inv_eps_scale, inv_mu_scale)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
qreal(kind=R8P)in
q_facereal(kind=R8P)in
dqreal(kind=R8P)inout
block_idsinteger(kind=I4P)in
faceinteger(kind=I4P)in
inv_eps_scalereal(kind=R8P)in
inv_mu_scalereal(kind=R8P)in

Call graph

compute_x_face_pml_rhs ​

fortran
subroutine compute_x_face_pml_rhs(self, q, q_face, dq_face, block_ids, face, inv_eps_scale, inv_mu_scale, exact, lam_face)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
qreal(kind=R8P)in
q_facereal(kind=R8P)in
dq_facereal(kind=R8P)inout
block_idsinteger(kind=I4P)in
faceinteger(kind=I4P)in
inv_eps_scalereal(kind=R8P)in
inv_mu_scalereal(kind=R8P)in
exactlogicalinExact decay: the residual is the source alone.
lam_facereal(kind=R8P)inoutDecay rate (written with the exact decay).

Call graph

compute_y_face_pml_rhs ​

fortran
subroutine compute_y_face_pml_rhs(self, q, q_face, dq_face, block_ids, face, inv_eps_scale, inv_mu_scale, exact, lam_face)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
qreal(kind=R8P)in
q_facereal(kind=R8P)in
dq_facereal(kind=R8P)inout
block_idsinteger(kind=I4P)in
faceinteger(kind=I4P)in
inv_eps_scalereal(kind=R8P)in
inv_mu_scalereal(kind=R8P)in
exactlogicalinExact decay: the residual is the source alone.
lam_facereal(kind=R8P)inoutDecay rate (written with the exact decay).

Call graph

compute_z_face_pml_rhs ​

fortran
subroutine compute_z_face_pml_rhs(self, q, q_face, dq_face, block_ids, face, inv_eps_scale, inv_mu_scale, exact, lam_face)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
qreal(kind=R8P)in
q_facereal(kind=R8P)in
dq_facereal(kind=R8P)inout
block_idsinteger(kind=I4P)in
faceinteger(kind=I4P)in
inv_eps_scalereal(kind=R8P)in
inv_mu_scalereal(kind=R8P)in
exactlogicalinExact decay: the residual is the source alone.
lam_facereal(kind=R8P)inoutDecay rate (written with the exact decay).

Call graph

compute_pml_coefficients ​

Return the face-local ADE-PML coefficients for the supported variants.

Attributes: pure

fortran
subroutine compute_pml_coefficients(self, center_distance, span, gamma, alpha, kappa)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
center_distancereal(kind=R8P)in
spanreal(kind=R8P)in
gammareal(kind=R8P)out
alphareal(kind=R8P)out
kappareal(kind=R8P)out

Call graph

compute_residuals_fv_centered ​

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

fortran
subroutine compute_residuals_fv_centered(self, q, dq, s, flux_register)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.
qreal(kind=R8P)inoutConservative variables.
dqreal(kind=R8P)inoutResiduals.
sinteger(kind=I4P)inoptionalStage counter.
flux_registerclass(flux_register_object)inoutoptionalForest's flux register; FV reflux.

Call graph

accumulate_seam_fluxes_fv ​

Accumulate the face fluxes of one RK stage, weighted by the stage's SSP coefficient weight = beta_s, on the seam faces of the FV-centered scheme.

Walks every (block, fec) pair and, for non-zero entries in self%adam%maps%inter_realm_face_register_index(b, fec), packs the appropriate flx_f/fly_f/flz_f face skin into a (nv, nface_cells) slab and routes it to the right register accumulator: positive index → coarse side → accumulate_coarse_flux, negative index → fine side → accumulate_fine_flux. The call site fires at every stage, so the register sums the stage fluxes into the step flux sum_s beta_s F_s of both sides.

The register accumulators are sized (nv, nface_cells, 1) under α.r1 (M2 reshape) with the full state-vector width nv (set at register_face time from realm%adam%field%nv). The FV scheme only fills the conservative slice 1:nv_c of the flux arrays; the remaining rows are left at zero in flux_slab so the register's F_coarse - F_fine_sum correction is identically zero outside the conservative variables. The third-axis index passed to accumulate_*_flux is hardcoded to 1 (collapsed register).

For a same-resolution mirror seam (rmf-2realm), each coarse and fine side carries an identical end-of-step flux; F_coarse - F_fine_sum is round-off zero in expectation and the downstream q-correction is a no-op. For a true 2:1 intra-realm AMR jump (#13 §7.5 M3) the coarse and fine sides differ:

  • Coarse side (sgn_idx > 0): packs its full nface_cells-cell face skin directly — the linear index c runs (inner axis fastest, outer axis slowest) over the coarse cells, exactly as before.
  • Fine side (sgn_idx < 0): each of the ratio/2 (4 in 3D) fine blocks covers ONE quadrant of the coarse face. Its nj*nk fine-face cells are 2:1-restricted (2x2 conservative average) onto the (nj/2)*(nk/2) coarse cells of that quadrant, written into the coarse-skin-shaped slab at the quadrant offset (zero elsewhere), then accumulated. The quadrant offset is read from maps%amr_seam_quadrant, precomputed at registration from the two blocks' Morton codes (issue #28 D2 — the coarse partner may live on another rank, so its geometry is not readable here). The fine blocks' accumulate_fine_flux calls sum into disjoint quadrants, so F_fine_sum ends up holding the area-averaged fine flux over the WHOLE coarse face, matching F_coarse's shape for the Berger-Colella delta.

Conservative 2:1 averaging (arithmetic mean of the 2x2 fine sub-faces) is the correct restriction for a face FLUX (Berger-Colella 1989 §4; Olivares 2019 Eq. 26-27): the coarse-face flux equals the average of the fine-face fluxes covering it, so the telescoping ∮F·n across the seam cancels to round-off.

The FD-centered case does not reach this routine (different residual target).

fortran
subroutine accumulate_seam_fluxes_fv(self, ni, nj, nk, nv_c, blocks_number, weight, flux_register)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe realm.
niinteger(kind=I4P)inInterior cell counts.
njinteger(kind=I4P)inInterior cell counts.
nkinteger(kind=I4P)inInterior cell counts.
nv_cinteger(kind=I4P)inNumber of conservative variables.
blocks_numberinteger(kind=I4P)inNumber of local blocks.
weightreal(kind=R8P)inStage weight, the SSP coefficient beta_s.
flux_registerclass(flux_register_object)inoutForest's flux register.

Call graph

compute_residuals_weno ​

Compute residuals of equation, space operator, WENO schemes.

fortran
subroutine compute_residuals_weno(self, q, dq, s, flux_register)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.
qreal(kind=R8P)inoutConservative variables.
dqreal(kind=R8P)inoutResiduals.
sinteger(kind=I4P)inoptionalStage counter.
flux_registerclass(flux_register_object)inoutoptionalFlux register.

Call graph

pic_begin_step ​

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

fortran
subroutine pic_begin_step(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

pic_begin_stage ​

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

fortran
subroutine pic_begin_stage(self, k, up)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_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: x' = v, v' = (q/m) (E + v x B), the fields gathered at the stage positions (pic_fields, D scaled to E); charge and mass constant.

fortran
subroutine pic_residual(self, up)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_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_cpu_object)inoutThe equation.
kinteger(kind=I4P)inStage.

Call graph

pic_finish_step ​

Close the step of the particles' companion: SELAH advances the particles.

fortran
subroutine pic_finish_step(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_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_cpu_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_cpu_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_cpu_object)inoutThe equation.
kinteger(kind=I4P)inStage.

Call graph

pml_finish_step ​

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

fortran
subroutine pml_finish_step(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

integrate_rk_ls ​

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

fortran
subroutine integrate_rk_ls(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

integrate_rk_ssp ​

Integrate equation, time operator, SSP RK schemes: SELAH's Butcher form (#132), each stage state on the stepper's register, its residual into dq, copied into the stepper's residual register; the PML auxiliary fields advance in step on their own storage with the same tableau.

fortran
subroutine integrate_rk_ssp(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

integrate_rk_ssp_pic ​

Integrate equation, time operator, SSP RK schemes. SSP RK on SELAH's Butcher form, the stage states on the stepper's registers.

fortran
subroutine integrate_rk_ssp_pic(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

integrate_rk_ssp_pic_charge_conserving ​

Integrate PIC equations with SSP RK and charge-conserving current reconstruction.

fortran
subroutine integrate_rk_ssp_pic_charge_conserving(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inout

Call graph

compute_pic_esirkepov_displacement ​

Symmetric Esirkepov density decomposition for the same separable shape used by rho.

fortran
subroutine compute_pic_esirkepov_displacement(self, q_ref, q_to, h_dir, particle)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
q_refreal(kind=R8P)in
q_toreal(kind=R8P)in
h_dirreal(kind=R8P)inout
particleinteger(kind=I4P)inoptional

Call graph

compute_esirkepov_gaussian_shape_1d ​

Normalize the filtered Gaussian on the endpoint's own deposition stencil. Its tensor product equals Gaussian_charge_weighting's 3D normalization up to roundoff.

fortran
subroutine compute_esirkepov_gaussian_shape_1d(self, x, x_cell, dx, ip, radius, lo, hi, w)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
xreal(kind=R8P)in
x_cellreal(kind=R8P)in
dxreal(kind=R8P)in
ipinteger(kind=I4P)in
radiusinteger(kind=I4P)in
lointeger(kind=I4P)in
hiinteger(kind=I4P)in
wreal(kind=R8P)out

Call graph

esirkepov_shape_weight_1d ​

Apply the optional binomial filter to the B-spline before computing particle fluxes.

fortran
subroutine esirkepov_shape_weight_1d(self, x, xc, dx, w)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
xreal(kind=R8P)in
xcreal(kind=R8P)in
dxreal(kind=R8P)in
wreal(kind=R8P)out

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_cpu_object)inout

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

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inout
qreal(kind=R8P)inout
weightreal(kind=R8P)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_cpu_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_cpu_object)inout

Call graph

solve_pic_charge_conserving_current_dispatch ​

Select the configured charge-conserving current reconstruction.

fortran
subroutine solve_pic_charge_conserving_current_dispatch(self, q, hq)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inout
qreal(kind=R8P)inout
hqreal(kind=R8P)in

Call graph

ensure_londrillo_current_solver_cache ​

Factor the interior face map plus one checkerboard constraint per line.

fortran
subroutine ensure_londrillo_current_solver_cache(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inout

Call graph

solve_pic_charge_conserving_current_londrillo ​

Londrillo et al. 2010 (P = I, rho unfiltered): integrate Esirkepov's directional charge changes to faces and invert D = G A along every line, the collocated null mode of A fixed by the checkerboard constraint.

fortran
subroutine solve_pic_charge_conserving_current_londrillo(self, q, hq)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inout
qreal(kind=R8P)inout
hqreal(kind=R8P)in

Call graph

modified_kernels ​

P and Q kernels of the matched current in use (matched_kernels of prism_pic_object).

fortran
subroutine modified_kernels(self, p, qw, radius, qfirst, nq)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
preal(kind=R8P)out
qwreal(kind=R8P)out
radiusinteger(kind=I4P)out
qfirstinteger(kind=I4P)out
nqinteger(kind=I4P)out

Call graph

filter_modified_axis ​

Zero extension is used only outside the block; supported particles stay in the bulk.

fortran
subroutine filter_modified_axis(input, output, axis, p, radius)

Arguments

NameTypeIntentAttributesDescription
inputreal(kind=R8P)in
outputreal(kind=R8P)out
axisinteger(kind=I4P)in
preal(kind=R8P)in
radiusinteger(kind=I4P)in

Call graph

filter_matched_box_axis ​

Convolution along one axis of the matched box current, output_c = sum_t w(t) input_{c+first+t}: circular along a periodic axis (the fold of deposit_matched_current), zero extension otherwise (supports stay off the non-periodic faces, check_matched_support). Q: w = qw(0:nq-1), first = qfirst (faces to cells, face f stored at cell f); P: w = p(-radius:radius), first = -radius. FNL twin: box_filter_axis.

fortran
subroutine filter_matched_box_axis(input, output, axis, w, first, periodic)

Arguments

NameTypeIntentAttributesDescription
inputreal(kind=R8P)in
outputreal(kind=R8P)out
axisinteger(kind=I4P)in
wreal(kind=R8P)in
firstinteger(kind=I4P)in
periodiclogicalin

Call graph

filter_matched_passes ​

The P or Q kernel of the matched current along one axis as the passes of matched_factors (issue #112, M3 F2), each a filter_matched_box_axis: fa in, fa out (fb scratch). Equal to the single convolution up to roundoff (zero extension between the passes only near a non-periodic face, which no support reaches).

fortran
subroutine filter_matched_passes(self, kernel, fa, fb, axis)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
kernelcharacter(len=1)in
fareal(kind=R8P)inout
fbreal(kind=R8P)inout
axisinteger(kind=I4P)in

Call graph

matched_shape_1d ​

Base-shape weights of the matched current and charge along one axis, on the cells ic-radius..ic+radius: closed B-spline (bspline_closed_weights) or Gaussian normalized on the stencil, as compute_pic_esirkepov_displacement. Cell indices are unwrapped (any i, center emin+(i-1/2)dx), so that a shape across a periodic face is built in one piece and folded afterwards; the current and the charge take the same weights, so the continuity is exact to roundoff.

fortran
subroutine matched_shape_1d(self, axis, b, x, ic, radius, w)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
axisinteger(kind=I4P)in
binteger(kind=I4P)in
xreal(kind=R8P)in
icinteger(kind=I4P)in
radiusinteger(kind=I4P)in
wreal(kind=R8P)out

Call graph

check_matched_support ​

Along a non-periodic axis the cells lo..hi of a particle support, widened by the P taps, must stay inside the block.

fortran
subroutine check_matched_support(self, lo, hi)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
lointeger(kind=I4P)in
hiinteger(kind=I4P)in

Call graph

fold_matched_cell ​

Fold an unwrapped cell into the block interior along the periodic axes; along the others it must be inside.

fortran
subroutine fold_matched_cell(self, idx)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
idxinteger(kind=I4P)inout

Call graph

deposit_matched_current ​

Matched current (totorica, esirkepov_Q<N>) of the trajectories q_ref -> q_to, folded into the block interior: J_d = Q_d P_e1 P_e2 F_d^E, F_d^E(f) = -dx_d/dt sum_{i<=f} W_d(i), W_d being Esirkepov's directional charge change. W_d = rho_q dL (x) [t0 (x) (s0 + ds/2) + dt (x) (s0/2 + ds/3)], with dL, t0, dt, s0, ds the 1-D weights (and their changes) along d and the transverse axes e1 < e2. Q and P are finite shift-invariant stencils, so they commute with the sum over the particles: each particle deposits only F_d^E on its box (face f stored at cell f), then Q_d P_e1 P_e2 are applied once on the block (filter_matched_box_axis, circular along the periodic axes). The prefix sum stays per particle: F_d^E vanishes past the box (sum of dL = 0, its roundoff residual cut as the zero-flux closure of the line solve did), so the current of a particle is exactly zero outside its box widened by the P and Q taps (no tails between particles) and the current through a periodic face is kept; a prefix sum on the grid would make J nonlocal and lose that k = 0 mode. Cells are unwrapped and folded modulo n along the periodic axes on writing. In exact arithmetic it equals the line solve of the summed source (solve_pic_charge_conserving_current_modified). Single block (check_conserving_single_block). FNL twin: deposit_matched_current_box.

fortran
subroutine deposit_matched_current(self, q_ref, q_to, jc)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inout
q_refreal(kind=R8P)in
q_toreal(kind=R8P)in
jcreal(kind=R8P)outCurrent (3, ni, nj, nk, nb), block interior.

Call graph

store_matched_current ​

Write a matched current (block interior) into q and set its ghosts as the line solves did (impose_odd_current_ghosts).

fortran
subroutine store_matched_current(self, q, jc)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inout
qreal(kind=R8P)inout
jcreal(kind=R8P)in

Call graph

deposit_matched_charge_box ​

Matched charge rho = P S rho^P of totorica and esirkepov_Q<N>: the unfiltered base shape (on the dual nodes x_c+dx/2 for the odd esirkepov_Q<N>, i.e. the particle seen at x-dx/2) filtered by P along every axis. P is a finite shift-invariant stencil, so it commutes with the sum over the particles: each particle deposits only its base shape, from the 1-D weights of matched_shape_1d (those of the matched current), folded into the block interior along the periodic axes as deposit_matched_current (the deposit with periodic faces), then P is applied once on the block along every axis (filter_matched_box_axis, circular along the periodic axes). Ghosts are zero. FNL twin: deposit_matched_charge_box.

fortran
subroutine deposit_matched_charge_box(self, q)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inout
qreal(kind=R8P)inout

Call graph

deposit_pic_modified_charge ​

Deposit the unfiltered particle shape, then apply P_c=Q A in all directions.

fortran
subroutine deposit_pic_modified_charge(self, q)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inout
qreal(kind=R8P)inout

Call graph

initialize_pic_conserving_current_time_zero ​

Deposit the current at t=0 using the same trajectory operator as the PIC evolution.

fortran
subroutine initialize_pic_conserving_current_time_zero(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inout

Call graph

check_conserving_single_block ​

The CPU charge-conserving current is single-block by design (line solves and P/Q filters per block); the multi-block version is FNL-only (prism_fnl_pic_conserving_object, virtual-block solves).

fortran
subroutine check_conserving_single_block(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in

Call graph

modified_current_line ​

F^E is the face prefix sum of the directional Esirkepov charge change.

fortran
subroutine modified_current_line(self, source, dir, b, n, qw, qfirst, nq, sol)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inout
sourcereal(kind=R8P)in
dirinteger(kind=I4P)in
binteger(kind=I4P)in
ninteger(kind=I4P)in
qwreal(kind=R8P)in
qfirstinteger(kind=I4P)in
nqinteger(kind=I4P)in
solreal(kind=R8P)out

Call graph

solve_pic_charge_conserving_current_modified ​

J_d=Q_d P_transverse F_d^E; no inverse reconstruction or line solve.

fortran
subroutine solve_pic_charge_conserving_current_modified(self, q, hq)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inout
qreal(kind=R8P)inout
hqreal(kind=R8P)in

Call graph

solve_modified_current_with_cleanup ​

Reconstruct one particle's SSP source at a time, clean its matched current, then accumulate.

fortran
subroutine solve_modified_current_with_cleanup(self, q, q_ref, q_to_history, active_stage, mixed_source)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inout
qreal(kind=R8P)inout
q_refreal(kind=R8P)in
q_to_historyreal(kind=R8P)in
active_stageinteger(kind=I4P)in
mixed_sourcereal(kind=R8P)inoptional

Call graph

cleanup_modified_particle_current ​

Zero only sub-threshold leakage outside the exact P/Q-expanded source support.

fortran
subroutine cleanup_modified_particle_current(self, q_particle, particle, block, shape_lo, shape_hi)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
q_particlereal(kind=R8P)inout
particleinteger(kind=I4P)in
blockinteger(kind=I4P)in
shape_lointeger(kind=I4P)in
shape_hiinteger(kind=I4P)in

Call graph

report_particle_tail_error ​

fortran
subroutine report_particle_tail_error(particle, component, block, i, j, k, value, j_ref, ratio, lo, hi)

Arguments

NameTypeIntentAttributesDescription
particleinteger(kind=I4P)in
componentinteger(kind=I4P)in
blockinteger(kind=I4P)in
iinteger(kind=I4P)in
jinteger(kind=I4P)in
kinteger(kind=I4P)in
valuereal(kind=R8P)in
j_refreal(kind=R8P)in
ratioreal(kind=R8P)in
lointeger(kind=I4P)in
hiinteger(kind=I4P)in

Call graph

build_esirkepov_face_line ​

fortran
subroutine build_esirkepov_face_line(self, source, dir, b, n, flux)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inout
sourcereal(kind=R8P)in
dirinteger(kind=I4P)in
binteger(kind=I4P)in
ninteger(kind=I4P)in
fluxreal(kind=R8P)out

Call graph

update_esirkepov_face_residual ​

Check the reconstructed flux on both boundary faces and every interior face.

fortran
subroutine update_esirkepov_face_residual(self, n, sol, flux)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inout
ninteger(kind=I4P)in
solreal(kind=R8P)in
fluxreal(kind=R8P)in

Call graph

find_pic_position_cell ​

Locate one PIC position on the local Cartesian block grid.

fortran
subroutine find_pic_position_cell(self, q_pos, b, i, j, k)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
q_posreal(kind=R8P)in
binteger(kind=I4P)out
iinteger(kind=I4P)out
jinteger(kind=I4P)out
kinteger(kind=I4P)out

Call graph

particle_weighting_radius ​

Integer support radius for the configured particle shape.

fortran
subroutine particle_weighting_radius(self, b, rx, ry, rz)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
binteger(kind=I4P)in
rxinteger(kind=I4P)out
ryinteger(kind=I4P)out
rzinteger(kind=I4P)out

Call graph

particle_shape_weight_1d ​

One-dimensional particle shape used by the PIC charge deposition.

fortran
subroutine particle_shape_weight_1d(self, model, x, xc, dx, w, cutoff_limit)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
modelcharacter(len=*)in
xreal(kind=R8P)in
xcreal(kind=R8P)in
dxreal(kind=R8P)in
wreal(kind=R8P)out
cutoff_limitreal(kind=R8P)inoptional

Call graph

build_centered_reconstruction_matrix ​

Build face-reconstruction matrix R such that FD1_CC J = (R_{i+1/2}-R_{i-1/2})/dx.

fortran
subroutine build_centered_reconstruction_matrix(self, n, a)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
ninteger(kind=I4P)in
areal(kind=R8P)inout

Call graph

factorize_matrix_pivot ​

fortran
subroutine factorize_matrix_pivot(a, pivot, n)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inout
pivotinteger(kind=I4P)out
ninteger(kind=I4P)in

Call graph

solve_factored_matrix_pivot ​

fortran
subroutine solve_factored_matrix_pivot(a, pivot, rhs, sol, n)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)in
pivotinteger(kind=I4P)in
rhsreal(kind=R8P)in
solreal(kind=R8P)out
ninteger(kind=I4P)in

Call graph

odd_mirror_index ​

fortran
subroutine odd_mirror_index(idx, n, col, sgn)

Arguments

NameTypeIntentAttributesDescription
idxinteger(kind=I4P)in
ninteger(kind=I4P)in
colinteger(kind=I4P)out
sgnreal(kind=R8P)out

Call graph

impose_zero_current_ghosts ​

Zero the normal current in the physical boundary ghosts (rows of local_map_bc_crown). The ghosts of block interfaces and of periodic faces keep the exchanged current.

fortran
subroutine impose_zero_current_ghosts(self, q)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
qreal(kind=R8P)inout

Call graph

impose_odd_current_ghosts ​

Zero normal face flux: J outside the face is the odd mirror of J inside. Along a periodic axis the ghosts are the periodic images instead (single block: the opposite interior of the same block).

fortran
subroutine impose_odd_current_ghosts(self, q)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
qreal(kind=R8P)inout

Call graph

integrate_rk_yoshida ​

Integrate equation, time operator, Yoshida RK scheme: SELAH's yoshida-4 splitting (#132 phase 4), its 7 flows alternating the partitions B (VAR_BX:VAR_BZ, first) and D (VAR_DX:VAR_DZ), a residual per flow on q, the flow's partition advanced by its fraction of the step (the interior cells; not masked, as before).

fortran
subroutine integrate_rk_yoshida(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

ts_begin_step ​

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

fortran
subroutine ts_begin_step(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_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_cpu_object)inoutThe equation.
sinteger(kind=I4P)inStage.

Call graph

ts_end_stage ​

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

fortran
subroutine ts_end_stage(self, s)

Arguments

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

Call graph

ts_finish_step ​

Close the stepper's step: the Butcher form advances q, with the step residual in dq when asked (as the former update_q, whose callers asked for it on the unmasked SSP path only).

fortran
subroutine ts_finish_step(self, with_dq)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.
with_dqlogicalinCompute the step residual into dq.

Call graph

copy_stage_state ​

Copy the stepper's stage state, ghosts included, into q (the PIC stage scratch, as q_rk(:,...,s) was).

fortran
subroutine copy_stage_state(self, q)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inThe equation.
qreal(kind=R8P)inoutCopy.

Call graph

compute_dxyz_min ​

Compute minimum dxyz space step.

fortran
subroutine compute_dxyz_min(blocks_number, dxyz, dxyz_min)

Arguments

NameTypeIntentAttributesDescription
blocks_numberinteger(kind=I4P)inNumber of blocks.
dxyzreal(kind=R8P)inXYZ space steps.
dxyz_minreal(kind=R8P)outMinimum space step.

Call graph

compute_fluxes_convective_weno ​

Compute convective fluxes along direction dir, WENO scheme for space operator.

Host dispatcher (issue #139, S5, decision D3: the dispatch structure of FLUME's kernels): the kernel of the WENO half-width weno_s, compiled with S a named constant (_s1 ... _s5), whose one body (adam_prism_cpu_weno_fluxes_body.INC) holds the face loops with the flux decomposition and the reconstruction by SETH's WENO-JS kernel of that width, renamed weno_width, with SETH's descaler.

fortran
subroutine compute_fluxes_convective_weno(dir, blocks_number, ni, nj, nk, ngc, nv_c, weno_s, weno_eps, weno_sigma, evmax, erw, elw, chi, q, fluxes)

Arguments

NameTypeIntentAttributesDescription
dirinteger(kind=I4P)inDirection, 1=X, 2=Y, 3=Z.
blocks_numberinteger(kind=I4P)inNumber of blocks.
niinteger(kind=I4P)inGrid cells number in I direction.
njinteger(kind=I4P)inGrid cells number in J direction.
nkinteger(kind=I4P)inGrid cells number in K direction.
ngcinteger(kind=I4P)inGhost cells number.
nv_cinteger(kind=I4P)inNumber of conservative varibales.
weno_sinteger(kind=I4P)inWeno stencils number/dimension.
weno_epsreal(kind=R8P)inRegulariser of the WENO smoothness indicators.
weno_sigmareal(kind=R8P)inWENO descaler switch (0 Jiang-Shu, 1 scale-invariant).
evmaxreal(kind=R8P)inMaximum waves speed estimation.
erwreal(kind=R8P)inRight eigenvectors for WENO reconstruction.
elwreal(kind=R8P)inLeft eigenvectors for WENO reconstruction.
chireal(kind=R8P)inSpeed parameter for divergence cleaning.
qreal(kind=R8P)inField variables.
fluxesreal(kind=R8P)inoutFluxes.

Call graph

compute_fluxes_convective_weno_s1 ​

compute_fluxes_convective_weno for WENO-1: the stencil half-width S = 1 is a compile-time constant.

fortran
subroutine compute_fluxes_convective_weno_s1(dir, blocks_number, ni, nj, nk, ngc, nv_c, weno_eps, weno_sigma, evmax, erw, elw, chi, q, fluxes)

Arguments

NameTypeIntentAttributesDescription
dirinteger(kind=I4P)inDirection, 1=X, 2=Y, 3=Z.
blocks_numberinteger(kind=I4P)inNumber of blocks.
niinteger(kind=I4P)inGrid cells number in I direction.
njinteger(kind=I4P)inGrid cells number in J direction.
nkinteger(kind=I4P)inGrid cells number in K direction.
ngcinteger(kind=I4P)inGhost cells number.
nv_cinteger(kind=I4P)inNumber of conservative varibales.
weno_epsreal(kind=R8P)inRegulariser of the WENO smoothness indicators.
weno_sigmareal(kind=R8P)inWENO descaler switch (0 Jiang-Shu, 1 scale-invariant).
evmaxreal(kind=R8P)inMaximum waves speed estimation.
erwreal(kind=R8P)inRight eigenvectors for WENO reconstruction.
elwreal(kind=R8P)inLeft eigenvectors for WENO reconstruction.
chireal(kind=R8P)inSpeed parameter for divergence cleaning.
qreal(kind=R8P)inField variables.
fluxesreal(kind=R8P)inoutFluxes.

Call graph

compute_fluxes_convective_weno_s2 ​

compute_fluxes_convective_weno for WENO-3: the stencil half-width S = 2 is a compile-time constant.

fortran
subroutine compute_fluxes_convective_weno_s2(dir, blocks_number, ni, nj, nk, ngc, nv_c, weno_eps, weno_sigma, evmax, erw, elw, chi, q, fluxes)

Arguments

NameTypeIntentAttributesDescription
dirinteger(kind=I4P)inDirection, 1=X, 2=Y, 3=Z.
blocks_numberinteger(kind=I4P)inNumber of blocks.
niinteger(kind=I4P)inGrid cells number in I direction.
njinteger(kind=I4P)inGrid cells number in J direction.
nkinteger(kind=I4P)inGrid cells number in K direction.
ngcinteger(kind=I4P)inGhost cells number.
nv_cinteger(kind=I4P)inNumber of conservative varibales.
weno_epsreal(kind=R8P)inRegulariser of the WENO smoothness indicators.
weno_sigmareal(kind=R8P)inWENO descaler switch (0 Jiang-Shu, 1 scale-invariant).
evmaxreal(kind=R8P)inMaximum waves speed estimation.
erwreal(kind=R8P)inRight eigenvectors for WENO reconstruction.
elwreal(kind=R8P)inLeft eigenvectors for WENO reconstruction.
chireal(kind=R8P)inSpeed parameter for divergence cleaning.
qreal(kind=R8P)inField variables.
fluxesreal(kind=R8P)inoutFluxes.

Call graph

compute_fluxes_convective_weno_s3 ​

compute_fluxes_convective_weno for WENO-5: the stencil half-width S = 3 is a compile-time constant.

fortran
subroutine compute_fluxes_convective_weno_s3(dir, blocks_number, ni, nj, nk, ngc, nv_c, weno_eps, weno_sigma, evmax, erw, elw, chi, q, fluxes)

Arguments

NameTypeIntentAttributesDescription
dirinteger(kind=I4P)inDirection, 1=X, 2=Y, 3=Z.
blocks_numberinteger(kind=I4P)inNumber of blocks.
niinteger(kind=I4P)inGrid cells number in I direction.
njinteger(kind=I4P)inGrid cells number in J direction.
nkinteger(kind=I4P)inGrid cells number in K direction.
ngcinteger(kind=I4P)inGhost cells number.
nv_cinteger(kind=I4P)inNumber of conservative varibales.
weno_epsreal(kind=R8P)inRegulariser of the WENO smoothness indicators.
weno_sigmareal(kind=R8P)inWENO descaler switch (0 Jiang-Shu, 1 scale-invariant).
evmaxreal(kind=R8P)inMaximum waves speed estimation.
erwreal(kind=R8P)inRight eigenvectors for WENO reconstruction.
elwreal(kind=R8P)inLeft eigenvectors for WENO reconstruction.
chireal(kind=R8P)inSpeed parameter for divergence cleaning.
qreal(kind=R8P)inField variables.
fluxesreal(kind=R8P)inoutFluxes.

Call graph

compute_fluxes_convective_weno_s4 ​

compute_fluxes_convective_weno for WENO-7: the stencil half-width S = 4 is a compile-time constant.

fortran
subroutine compute_fluxes_convective_weno_s4(dir, blocks_number, ni, nj, nk, ngc, nv_c, weno_eps, weno_sigma, evmax, erw, elw, chi, q, fluxes)

Arguments

NameTypeIntentAttributesDescription
dirinteger(kind=I4P)inDirection, 1=X, 2=Y, 3=Z.
blocks_numberinteger(kind=I4P)inNumber of blocks.
niinteger(kind=I4P)inGrid cells number in I direction.
njinteger(kind=I4P)inGrid cells number in J direction.
nkinteger(kind=I4P)inGrid cells number in K direction.
ngcinteger(kind=I4P)inGhost cells number.
nv_cinteger(kind=I4P)inNumber of conservative varibales.
weno_epsreal(kind=R8P)inRegulariser of the WENO smoothness indicators.
weno_sigmareal(kind=R8P)inWENO descaler switch (0 Jiang-Shu, 1 scale-invariant).
evmaxreal(kind=R8P)inMaximum waves speed estimation.
erwreal(kind=R8P)inRight eigenvectors for WENO reconstruction.
elwreal(kind=R8P)inLeft eigenvectors for WENO reconstruction.
chireal(kind=R8P)inSpeed parameter for divergence cleaning.
qreal(kind=R8P)inField variables.
fluxesreal(kind=R8P)inoutFluxes.

Call graph

compute_fluxes_convective_weno_s5 ​

compute_fluxes_convective_weno for WENO-9: the stencil half-width S = 5 is a compile-time constant.

fortran
subroutine compute_fluxes_convective_weno_s5(dir, blocks_number, ni, nj, nk, ngc, nv_c, weno_eps, weno_sigma, evmax, erw, elw, chi, q, fluxes)

Arguments

NameTypeIntentAttributesDescription
dirinteger(kind=I4P)inDirection, 1=X, 2=Y, 3=Z.
blocks_numberinteger(kind=I4P)inNumber of blocks.
niinteger(kind=I4P)inGrid cells number in I direction.
njinteger(kind=I4P)inGrid cells number in J direction.
nkinteger(kind=I4P)inGrid cells number in K direction.
ngcinteger(kind=I4P)inGhost cells number.
nv_cinteger(kind=I4P)inNumber of conservative varibales.
weno_epsreal(kind=R8P)inRegulariser of the WENO smoothness indicators.
weno_sigmareal(kind=R8P)inWENO descaler switch (0 Jiang-Shu, 1 scale-invariant).
evmaxreal(kind=R8P)inMaximum waves speed estimation.
erwreal(kind=R8P)inRight eigenvectors for WENO reconstruction.
elwreal(kind=R8P)inLeft eigenvectors for WENO reconstruction.
chireal(kind=R8P)inSpeed parameter for divergence cleaning.
qreal(kind=R8P)inField variables.
fluxesreal(kind=R8P)inoutFluxes.

Call graph

compute_fluxes_difference ​

Compute fluxes difference.

fortran
subroutine compute_fluxes_difference(blocks_number, ni, nj, nk, ngc, nv_c, var_Jx, var_Jy, var_Jz, phi_ivar, psi_ivar, rho_ivar, use_rho, chi_wave2, alpha, dx, dy, dz, flx, fly, flz, q, dq)

Arguments

NameTypeIntentAttributesDescription
blocks_numberinteger(kind=I4P)inNumber of blocks.
niinteger(kind=I4P)inGrid cells number in I direction.
njinteger(kind=I4P)inGrid cells number in J direction.
nkinteger(kind=I4P)inGrid cells number in K direction.
ngcinteger(kind=I4P)inGhost cells number.
nv_cinteger(kind=I4P)inNumber of conservative varibales in q.
var_Jxinteger(kind=I4P)inCurrent variable indices.
var_Jyinteger(kind=I4P)inCurrent variable indices.
var_Jzinteger(kind=I4P)inCurrent variable indices.
phi_ivarinteger(kind=I4P)in
psi_ivarinteger(kind=I4P)in
rho_ivarinteger(kind=I4P)in
use_rhologicalin
chi_wave2real(kind=R8P)in
alphareal(kind=R8P)in
dxreal(kind=R8P)inSpace steps.
dyreal(kind=R8P)inSpace steps.
dzreal(kind=R8P)inSpace steps.
flxreal(kind=R8P)inX direction fluxes.
flyreal(kind=R8P)inY direction fluxes.
flzreal(kind=R8P)inZ direction fluxes.
qreal(kind=R8P)inFields.
dqreal(kind=R8P)inoutFluxes differences.

Call graph

compute_field_mean_value ​

Compute mean value of the field in a certain region of the domain.

fortran
subroutine compute_field_mean_value(self, q, n_x, n_y, n_z, n_b, mean_value)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inThe object
qreal(kind=R8P)inField variables.
n_xinteger(kind=I4P)inNumber of cells in each direction and number of blocks
n_yinteger(kind=I4P)inNumber of cells in each direction and number of blocks
n_zinteger(kind=I4P)inNumber of cells in each direction and number of blocks
n_binteger(kind=I4P)inNumber of cells in each direction and number of blocks
mean_valuereal(kind=R8P)outMean value of the field out of the fWLayer

Functions ​

is_face_line_seed_cpu ​

Attributes: pure

Returns: logical

fortran
function is_face_line_seed_cpu(face, i, j, k, ni, nj, nk) result(is_seed)

Arguments

NameTypeIntentAttributesDescription
faceinteger(kind=I4P)in
iinteger(kind=I4P)in
jinteger(kind=I4P)in
kinteger(kind=I4P)in
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in

Call graph

face_normal_direction_cpu ​

Attributes: pure

Returns: integer(kind=i4p)

fortran
function face_normal_direction_cpu(face) result(dir_n)

Arguments

NameTypeIntentAttributesDescription
faceinteger(kind=I4P)in

Call graph

silver_muller_unknown_coefficient_cpu ​

Attributes: pure

Returns: real(kind=r8p)

fortran
function silver_muller_unknown_coefficient_cpu(face, m, hs, ds) result(coeff)

Arguments

NameTypeIntentAttributesDescription
faceinteger(kind=I4P)in
minteger(kind=I4P)in
hsinteger(kind=I4P)in
dsreal(kind=R8P)in

Call graph

tangential_divergence_at_cell_cpu ​

Attributes: pure

Returns: real(kind=r8p)

fortran
function tangential_divergence_at_cell_cpu(q, ngc, b, i, j, k, hs, dxyz, dir_t1, dir_t2, var_t1, var_t2) result(div_t)

Arguments

NameTypeIntentAttributesDescription
qreal(kind=R8P)in
ngcinteger(kind=I4P)in
binteger(kind=I4P)in
iinteger(kind=I4P)in
jinteger(kind=I4P)in
kinteger(kind=I4P)in
hsinteger(kind=I4P)in
dxyzreal(kind=R8P)in
dir_t1integer(kind=I4P)in
dir_t2integer(kind=I4P)in
var_t1integer(kind=I4P)in
var_t2integer(kind=I4P)in

Call graph

normal_known_contribution_cpu ​

Attributes: pure

Returns: real(kind=r8p)

fortran
function normal_known_contribution_cpu(q, ngc, ni, nj, nk, b, face, i, j, k, hs, dxyz, var_n) result(div_n_known)

Arguments

NameTypeIntentAttributesDescription
qreal(kind=R8P)in
ngcinteger(kind=I4P)in
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in
binteger(kind=I4P)in
faceinteger(kind=I4P)in
iinteger(kind=I4P)in
jinteger(kind=I4P)in
kinteger(kind=I4P)in
hsinteger(kind=I4P)in
dxyzreal(kind=R8P)in
var_ninteger(kind=I4P)in

Call graph

normal_depth_from_cell_cpu ​

Attributes: pure

Returns: integer(kind=i4p)

fortran
function normal_depth_from_cell_cpu(face, i, j, k, ni, nj, nk) result(depth)

Arguments

NameTypeIntentAttributesDescription
faceinteger(kind=I4P)in
iinteger(kind=I4P)in
jinteger(kind=I4P)in
kinteger(kind=I4P)in
niinteger(kind=I4P)in
njinteger(kind=I4P)in
nkinteger(kind=I4P)in

Call graph

component_along_direction_cpu ​

Attributes: pure

Returns: real(kind=r8p)

fortran
function component_along_direction_cpu(q, ngc, b, var, dir, i, j, k, offset) result(value_)

Arguments

NameTypeIntentAttributesDescription
qreal(kind=R8P)in
ngcinteger(kind=I4P)in
binteger(kind=I4P)in
varinteger(kind=I4P)in
dirinteger(kind=I4P)in
iinteger(kind=I4P)in
jinteger(kind=I4P)in
kinteger(kind=I4P)in
offsetinteger(kind=I4P)in

Call graph

stages_per_step_forest ​

Number of integrator stages this realm exposes per step.

For the multi-realm path the forest drives the stage loop, so it needs to know K up front. ONLY runge-kutta-ssp-* is split into per-stage TBPs (begin_stage_forest / end_stage_forest): the staged protocol needs every stage on a register of its own (SELAH's Butcher form, ts%is_butcher()), which the two-register schemes (runge-kutta-1/2/3) and the Yoshida splitting do not have (issue #25: low-storage schemes once passed this gate silently and crashed far downstream). The forest queries this TBP only on the STAGED branch, so refusing here leaves the fused N=1/no-seam fast path — where those schemes run — untouched. Leapfrog, Blanes-Moan and CFM are refused at initialization (moved to SELAH, szaghi/SELAH#3).

Returns: integer(kind=I4P)

fortran
function stages_per_step_forest(self) result(K)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inThe realm.

Call graph

compute_pml_kappa ​

Attributes: pure

Returns: real(kind=r8p)

fortran
function compute_pml_kappa(self, center_distance, span) result(kappa)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in
center_distancereal(kind=R8P)in
spanreal(kind=R8P)in

Call graph

pic_box ​

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

Returns: type(box)

fortran
function pic_box(self) result(bx)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inThe equation.

Call graph

modified_filter_radius ​

Cells reached by the P filter, plus one for the half-cell shift of the odd filters (boundary margin).

Returns: integer(kind=i4p)

fortran
function modified_filter_radius(self) result(radius)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in

Call graph

modified_position_shift ​

Odd esirkepov_Q<N> deposit the base shape on the dual nodes x_c+dx/2 (P has an even number of taps, dual nodes to centers): this equals the regular deposit of the particle at x-dx/2. Zero for the even filters and the other solvers.

Returns: real(kind=R8P)

fortran
function modified_position_shift(self) result(shift)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)in

Call graph

dotproduct ​

Compute the scalar (dot) product.

Returns: real(kind=R8P)

fortran
function dotproduct(a, b) result(dot)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inLeft hand side.
breal(kind=R8P)inLeft hand side.

crossproduct ​

Returns: real(kind=R8P)

fortran
function crossproduct(a, b) result(cross)

Arguments

NameTypeIntentAttributesDescription
areal(kind=R8P)inLeft hand side.
breal(kind=R8P)inLeft hand side.