Appearance
adam_prism_fnl_object
ADAM, PRISM (Plasma Research usIng Simulation Methods) equations system class definition, GPU (FNL) backend.
Source: src/app/prism/fnl/adam_prism_fnl_object.F90
Dependencies
Contents
- prism_fnl_object
- compute_curl_interface_dev
- compute_derivative1_interface_dev
- compute_derivative2_interface_dev
- compute_derivative4_interface_dev
- compute_divergence_interface_dev
- compute_gradient_interface_dev
- compute_laplacian_interface_dev
- compute_residuals_interface_dev
- integrate_interface_dev
- destroy
- free_prism_core_gpu
- estimate_backend_memory_fnl
- allocate_gpu
- copy_cpu_gpu
- copy_gpu_cpu
- initialize_prism
- initialize_pml_fnl
- amr_update
- rebalance
- load_restart_files
- save_residuals
- save_simulation_data
- apply_fwl_correction
- compute_coils_current
- register_pic_deposition_on_coils_dev
- mark_by_j_vec_total_variation
- set_boundary_conditions
- set_initial_conditions
- update_ghost
- compute_curl_fd_dev
- compute_curl_fv_dev
- compute_derivative1_fd_dev
- compute_derivative1_fv_dev
- compute_derivative2_fd_dev
- compute_derivative2_fv_dev
- compute_derivative4_fd_dev
- compute_divergence_fd_dev
- compute_divergence_fv_dev
- compute_gradient_fd_dev
- compute_gradient_fv_dev
- compute_laplacian_fd_dev
- compute_laplacian_fv_dev
- compute_residuals_fd_centered_dev
- apply_pml_fd_centered_ade_dev
- fd_centered_plain_dev_kernel
- fd_centered_phi_dev_kernel
- fd_centered_psi_dev_kernel
- fd_centered_phi_psi_dev_kernel
- compute_residuals_fv_centered_dev
- fv_cell_fluxes_maxwell_dev_kernel
- fv_cell_fluxes_maxwell_adim_dev_kernel
- fv_cell_fluxes_maxwell_div_d_dev_kernel
- fv_cell_fluxes_maxwell_div_b_dev_kernel
- fv_cell_fluxes_maxwell_div_d_b_dev_kernel
- fv_cell_fluxes_maxwell_adim_div_d_dev_kernel
- fv_cell_fluxes_maxwell_adim_div_b_dev_kernel
- fv_cell_fluxes_maxwell_adim_div_d_b_dev_kernel
- fv_recon_x_dev_kernel
- fv_recon_y_dev_kernel
- fv_recon_z_dev_kernel
- fv_flux_diff_plain_dev_kernel
- fv_flux_diff_phi_dev_kernel
- fv_flux_diff_psi_dev_kernel
- fv_flux_diff_phi_psi_dev_kernel
- accumulate_seam_fluxes_fv_dev
- fv_pack_face_skin_dev_kernel
- fv_apply_reflux_face_dev_kernel
- integrate_rk_ssp_pic
- gather_pic_fields_dev
- fold_deposited_ghosts_dev
- migrate_particles
- sync_particle_number
- integrate_rk_ssp_pic_charge_conserving
- initialize_pic_conserving_current_time_zero
- pic_begin_step
- pic_begin_stage
- pic_residual
- pic_end_stage
- pic_finish_step
- pml_begin_step
- pml_begin_stage
- pml_end_stage
- pml_finish_step
- integrate_rk_ls_dev
- integrate_rk_ssp_dev
- ts_begin_step
- ts_begin_stage
- ts_end_stage
- ts_finish_step
- is_done_forest
- finalize_forest
- initialize_process_context
- finalize_mpi_forest
- simulate
- initialize_app_forest
- restart_state_forest
- set_initial_state_forest
- post_initial_state_forest
- compute_local_dt_forest
- advance_one_step_forest
- open_step_forest
- begin_stage_forest
- seam_ghosts_to_state
- end_stage_forest
- close_step_forest
- fill_seam_from_peer_forest
- pack_seam_cells_forest
- unpack_seam_cells_forest
- after_topology_build_forest
- apply_reflux_to_stage_forest
- post_step_forest
- compute_plasma_frequencies
- locate_particles_end_of_step
- compute_dt
- initialize_charge_conservation_diagnostic
- accumulate_charge_conservation_current
- finalize_charge_conservation_diagnostic
- save_charge_conservation_diagnostic
- compute_energy
- compute_energy_error
- compute_grms
- sample_probes
- sync_probes
- compute_magnetic_field_at_center_domain
- compute_max_divergence_outside_absorbing_layers
- compute_max_divergence
- has_tv_marker
- pic_box
- stages_per_step_forest
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
FV_FLUX_VARIANT_MAXWELL | integer(kind=I4P) | parameter | Plain dimensional Maxwell fluxes. |
FV_FLUX_VARIANT_MAXWELL_ADIM | integer(kind=I4P) | parameter | Plain adimensional Maxwell fluxes. |
FV_FLUX_VARIANT_MAXWELL_DIV_D | integer(kind=I4P) | parameter | Dimensional hyperbolic fluxes with D cleaning. |
FV_FLUX_VARIANT_MAXWELL_DIV_B | integer(kind=I4P) | parameter | Dimensional hyperbolic fluxes with B cleaning. |
FV_FLUX_VARIANT_MAXWELL_DIV_D_B | integer(kind=I4P) | parameter | Dimensional hyperbolic fluxes with D/B cleaning. |
FV_FLUX_VARIANT_MAXWELL_ADIM_DIV_D | integer(kind=I4P) | parameter | Adimensional hyperbolic fluxes with D cleaning. |
FV_FLUX_VARIANT_MAXWELL_ADIM_DIV_B | integer(kind=I4P) | parameter | Adimensional hyperbolic fluxes with B cleaning. |
FV_FLUX_VARIANT_MAXWELL_ADIM_DIV_D_B | integer(kind=I4P) | parameter | Adimensional hyperbolic fluxes with D/B cleaning. |
FD_RESIDUAL_VARIANT_PLAIN | integer(kind=I4P) | parameter | Centered-FD Maxwell residual without hyperbolic cleaning. |
FD_RESIDUAL_VARIANT_PHI | integer(kind=I4P) | parameter | Centered-FD Maxwell residual with phi cleaning only. |
FD_RESIDUAL_VARIANT_PSI | integer(kind=I4P) | parameter | Centered-FD Maxwell residual with psi cleaning only. |
FD_RESIDUAL_VARIANT_PHI_PSI | integer(kind=I4P) | parameter | Centered-FD Maxwell residual with phi/psi cleaning. |
PML_FACE_X_M | integer(kind=I4P) | parameter | |
PML_FACE_X_P | integer(kind=I4P) | parameter | |
PML_FACE_Y_M | integer(kind=I4P) | parameter | |
PML_FACE_Y_P | integer(kind=I4P) | parameter | |
PML_FACE_Z_M | integer(kind=I4P) | parameter | |
PML_FACE_Z_P | integer(kind=I4P) | parameter | |
PML_TYPE_CLASSIC_DIRECT | character(len=14) | parameter | |
GRMS_3DB_RATIO | real(kind=R8P) | parameter |
Derived Types
prism_fnl_object
PRISM equations system class definition, GPU (FNL) backend.
Inheritance
Extends: prism_common_object
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
io | type(io_object) | IO handler. | |
amr | type(amr_object) | AMR marker handler. | |
slices | type(slices_object) | Slices handler. | |
flail | type(flail_object) | FLAIL, the elliptic solver library (issue #84). | |
weno | type(weno_object) | WENO reconstructor. | |
with_weno | logical | Read [weno] and initialize weno (the app clears it when unused, #80 P5). | |
with_fdv | logical | Read [fdv] and bind the FD/FV operators (cleared when unused, #80 P5). | |
ib | type(ib_object) | Immersed boundary. | |
ts | type(stepper_object) | Time integrator on SELAH (stepper_object, #132). | |
selah_layout | integer(kind=I4P) | Layout of the fields ts integrates (the FNL apps set LAYOUT_V_LAST, their (b, i, j, k, v) device fields). | |
selah_partitions | integer(kind=I4P) | The variables (first, last) of the two partitions of a splitting scheme (PRISM's Yoshida: B then D); 0 for none. | |
adam | type(adam_object) | ADAM, grid + tree + field + maps orchestrator. | |
fdv_scheme | character(len=:) | allocatable | FDV scheme, fd/fv. |
fdv_order | integer(kind=I4P) | Order of finite difference/volume schemes, general order. | |
fdv_half_stencil | integer(kind=I4P) | Half stencil length of finite difference/volume schemes. | |
fdv_half_stencils | integer(kind=I4P) | Half stencil length of fdv schemes for each derivative up to 6. | |
ngc | integer(kind=I4P) | pointer | Number of ghost cells. |
ni | integer(kind=I4P) | pointer | Number of cells in i direction. |
nj | integer(kind=I4P) | pointer | Number of cells in j direction. |
nk | integer(kind=I4P) | pointer | Number of cells in k direction. |
nb | integer(kind=I4P) | pointer | Total blocks number for MPI. |
blocks_number | integer(kind=I4P) | pointer | Actual blocks number. |
nv | integer(kind=I4P) | pointer | Number 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_index | integer(kind=I4P) | ||
realms_number | integer(kind=I4P) | Realms in the forest (set by initialize_forest, #80 P3). Inter-realm seam coupling — currently-published stage buffer key. | |
stage_active | integer(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_copy | type(flux_register_object) | Procedure pointer TBPs for FDV operators (set at initialization by backend). | |
compute_block_total_variation | procedure(compute_block_total_variation_interface) | pass(self), pointer | Compute TV. |
compute_curl | procedure(compute_curl_interface) | pass(self), pointer | Compute curl. |
compute_curl_extended | procedure(compute_curl_interface) | pass(self), pointer | Compute curl on extended support. |
compute_derivative1 | procedure(compute_derivative1_interface) | pass(self), pointer | Compute deriv1. |
compute_derivative2 | procedure(compute_derivative2_interface) | pass(self), pointer | Compute deriv2. |
compute_derivative4 | procedure(compute_derivative4_interface) | pass(self), pointer | Compute deriv4. |
compute_divergence | procedure(compute_divergence_interface) | pass(self), pointer | Compute dive. |
compute_gradient | procedure(compute_gradient_interface) | pass(self), pointer | Compute grad. |
compute_gradient_extended | procedure(compute_gradient_interface) | pass(self), pointer | Compute gradient on extended support. |
compute_laplacian | procedure(compute_laplacian_interface) | pass(self), pointer | Compute laplac. |
save_em_only | logical | [IO] save_fields = em: the XH5F output holds D and B only. | |
amr_locked_ | logical | AMR 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_number | integer(kind=I4P) | Block-sized fields per block of the blocks budget (issue #112). | |
reserved_memory | real(kind=R8P) | Memory reserved outside the blocks by the budget, GB (issue #112). | |
restarted_at | integer(kind=I4P) | Iteration the run restarted from (-1: not a restart), issue #129 R6. | |
estimate_backend_memory | procedure(estimate_backend_memory_interface) | pointer, nopass | Backend memory outside the block fields, estimated before the blocks budget (issue #112); set by the backend before initialize, none when null (CPU). |
nv_c | integer(kind=I4P) | pointer | Number of conservative variables in q vector. |
nv_s | integer(kind=I4P) | pointer | Number of source variables in q vector. |
nv_cl | integer(kind=I4P) | pointer | Number of divergence cleaning variables in q vector. |
q | real(kind=R8P) | allocatable | Conservative cell centered variables. |
dq | real(kind=R8P) | allocatable | Residuals right hand side. |
q_pic | real(kind=R8P) | allocatable | PIC variables. |
pic_fields | real(kind=R8P) | allocatable | Fields value at particle locations. |
curl | real(kind=R8P) | allocatable | Curl fields. |
divergence | real(kind=R8P) | allocatable | Divergence fields. |
q_name | type(string) | allocatable | Fields names [1:nv]. |
dq_name | type(string) | allocatable | Residuals names [1:nv]. |
q_pic_name | type(string) | allocatable | PIC Fields names. |
curl_name | type(string) | allocatable | Curl fields names. |
div_name | type(string) | allocatable | Divergence fields names. |
energy_D | real(kind=R8P) | allocatable | Energy of field D, time history. |
energy_B | real(kind=R8P) | allocatable | Energy of field B, time history. |
coil_power | real(kind=R8P) | allocatable | Power of coils, time history. |
Poynting_flux | real(kind=R8P) | allocatable | Total Poynting flux from boundary, time history. |
rms_energy_error_D | real(kind=R8P) | RMS energy error of D field. | |
rms_energy_error_B | real(kind=R8P) | RMS energy error of B field. | |
max_divergence_D | real(kind=R8P) | Maximum of divergence of D field. | |
max_divergence_B | real(kind=R8P) | Maximum of divergence of B field. | |
max_divergence_J | real(kind=R8P) | Maximum of divergence of J field. | |
single_particle_output_last_time | real(kind=R8P) | Last time written to single-particle history. | |
single_particle_output_written | logical | Single-particle history write sentinel. | |
bc | type(prism_bc_object) | Boundary conditions. | |
coil | type(prism_coil_object) | Coil source term. | |
external_fields | type(prism_external_fields_object) | External fields. | |
fWLayer | type(prism_fWLayer_object) | Far-field weighted layer. | |
grms | type(prism_grms_object) | Grms diagnostic. | |
ic | type(prism_ic_object) | Initial conditions. | |
io_prism | type(prism_io_object) | The [IO] options only PRISM reads. | |
magnetic_field_at_center_domain | type(prism_magnetic_field_at_center_domain_object) | Domain-center B diagnostic. | |
numerics | type(prism_numerics_object) | Numerics configuration. | |
particle_injection | type(prism_particle_injection_object) | Particle injection. | |
physics | type(prism_physics_object) | Physics configuration. | |
pic | type(prism_pic_object) | PIC state. | |
plasma_freq | type(prism_plasma_frequencies_object) | Plasma frequencies and the PIC time-step limit. | |
pml | type(prism_pml_object) | Perfectly matched layer. | |
probes | type(prism_probes_object) | Field probes. | |
pic_st | type(stepper) | Particles: a SELAH companion (#134 D5). | |
pml_st | type(prism_pml_stepper_object) | PML auxiliary fields: SELAH companions (#134 D5). | |
time | type(prism_time_object) | Time integration state. | |
field_fnl | type(field_fnl_object) | GPU field handler. | |
ib_fnl | type(ib_fnl_object) | GPU immersed boundary. | |
coil_fnl | type(prism_fnl_coil_object) | GPU coil source. | |
pic_fnl | type(prism_fnl_pic_object) | GPU PIC support state. | |
conserving_fnl | type(prism_fnl_pic_conserving_object) | GPU charge-conserving PIC current. | |
plasma_freq_fnl | type(prism_fnl_plasma_frequencies_object) | GPU plasma frequencies (PIC time-step limit). | |
pml_fnl | type(prism_fnl_pml_object) | GPU PML compact metadata/state. | |
probes_fnl | type(prism_fnl_probes_object) | GPU field probes. | |
q_gpu | real(kind=R8P) | pointer | Field cell centered variables. |
dq_gpu | real(kind=R8P) | pointer | Residuals right hand side. |
flxyz_c_gpu | real(kind=R8P) | pointer | Fluxes at cell center with +/- decomposition for all directions. |
flx_f_gpu | real(kind=R8P) | pointer | Fluxes along x at cell face. |
fly_f_gpu | real(kind=R8P) | pointer | Fluxes along y at cell face. |
flz_f_gpu | real(kind=R8P) | pointer | Fluxes along z at cell face. |
j_vec_tv_gpu | real(kind=R8P) | pointer | Cell total variation of the coil j_vec (AMR_TV marker only). |
db5 | integer(kind=I4P) | Device data bounds (rank 5): bb(1,:)=lower, bb(2,:)=upper. | |
hb5 | integer(kind=I4P) | Host buffer data bounds (rank 5): bb(1,:)=lower, bb(2,:)=upper. | |
buf_5D_R8P | real(kind=R8P) | allocatable | Buffer (host memory, device shape), rank 5, R8P. |
db6 | integer(kind=I4P) | Device data bounds (rank 6): bb(1,:)=lower, bb(2,:)=upper. | |
hb6 | integer(kind=I4P) | Host buffer data bounds (rank 6): bb(1,:)=lower, bb(2,:)=upper. | |
buf_6D_R8P | real(kind=R8P) | allocatable | Buffer (host memory, device shape), rank 6, R8P. |
fv_flux_variant | integer(kind=I4P) | FV Maxwell-flux variant selector. | |
fv_add_phi_damping | logical | Apply phi damping in FV residuals. | |
fv_add_psi_damping | logical | Apply psi damping in FV residuals. | |
fv_ivar_phi | integer(kind=I4P) | Phi slot index in FV residuals. | |
fv_ivar_psi | integer(kind=I4P) | Psi slot index in FV residuals. | |
fd_residual_variant | integer(kind=I4P) | Centered-FD residual selector. | |
fd_ivar_phi | integer(kind=I4P) | Phi slot index in FD residuals. | |
fd_ivar_psi | integer(kind=I4P) | Psi slot index in FD residuals. | |
fd_inv_mu_scale | real(kind=R8P) | Dimensional/adimensional scaling on curl(B). | |
fd_inv_eps_scale | real(kind=R8P) | Dimensional/adimensional scaling on curl(D). | |
fd_chi_wave | real(kind=R8P) | Hyperbolic transport speed for phi/psi equations. | |
fd_alpha_damp | real(kind=R8P) | GLM damping rate for phi/psi equations. Pointer (abstract) TBP. | |
compute_curl_dev | procedure(compute_curl_interface_dev) | pass(self), pointer | Compute curl. |
compute_derivative1_dev | procedure(compute_derivative1_interface_dev) | pass(self), pointer | Compute derivative1. |
compute_derivative2_dev | procedure(compute_derivative2_interface_dev) | pass(self), pointer | Compute derivative2. |
compute_derivative4_dev | procedure(compute_derivative4_interface_dev) | pass(self), pointer | Compute derivative4. |
compute_divergence_dev | procedure(compute_divergence_interface_dev) | pass(self), pointer | Compute divergence. |
compute_gradient_dev | procedure(compute_gradient_interface_dev) | pass(self), pointer | Compute gradient. |
compute_laplacian_dev | procedure(compute_laplacian_interface_dev) | pass(self), pointer | Compute laplacian. |
compute_residuals_dev | procedure(compute_residuals_interface_dev) | pass(self), pointer | Compute residuals. |
integrate_dev | procedure(integrate_interface_dev) | pass(self), pointer | Integrate, time operator. |
charge_conservation_acc_gpu | real(kind=R8P) | pointer | PIC charge-continuity residual accumulator. |
charge_conservation_divj_gpu | real(kind=R8P) | pointer | PIC temporary div(J) for charge diagnostic. |
charge_conservation_error_max | real(kind=R8P) | Max PIC charge-continuity residual. | |
charge_conservation_ready | logical | True when current step PIC diagnostic is ready. | |
charge_conservation_step | logical | True when this PIC step feeds the history. | |
stage_ghosts_fresh | logical | update_ghost skips the exchange (boundary conditions and coil re-stamp kept): the caller refreshed the ghosts and changed only pointwise sources since. Set around one call, then cleared. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
load_fdv_from_file | pass(self) | Load FDV config from file. |
initialize_forest | pass(self), non_overridable | Invoked by forest%initialize per realm: the template. |
runtime_amr_forest | pass(self) | Whether this realm regrids during the run (#74). |
regrid_forest | pass(self) | Invoked by forest%regrid per realm per timestep (#74). |
regrid_begin_forest | pass(self) | Multi-realm regrid, phase 1: is it a regrid step (#110). |
regrid_mark_forest | pass(self) | Phase 2: mark one sweep, marks on the tree (#110). |
regrid_apply_forest | pass(self) | Phase 3: adapt to the (balanced) tree marks (#110). |
regrid_end_forest | pass(self) | Phase 4: refresh the grid-dependent state (#110). |
close_block_xh5f | nopass | Close XH5F file block. |
close_file_xh5f | nopass | Close XH5F file. |
open_block_xh5f | pass(self) | Open block file XH5F. |
open_file_xh5f | pass(self) | Open file XH5F. |
save_q_xh5f | pass(self) | Save in XH5F (XDMF/HDF5) format. |
compute_curl_fd_extended | pass(self) | Compute curl of vector field, finite difference, even for half gcs. |
compute_gradient_fd_extended | pass(self) | Compute gradient of scalar field, finite difference, even for half gcs. private FDV operators |
amr_update_initial_forest | pass(self) | Template hook: one initial regrid (host). |
initial_amr_iterations_forest | pass(self) | Template hook: [initial_conditions] AMR passes. |
rebalance_initial_forest | pass(self) | Template hook: the static rebalance (issue #123). |
reset_time_forest | pass(self) | Template hook: time and step counter to zero. |
mark_by_geometry | pass(self) | Mark blocks to be refined by a primitive geometric box. |
allocate_common | pass(self) | Allocate common data. |
compute_auxiliary_fields | pass(self) | Compute auxiliary fields. |
compute_fields_number | pass(self) | Compute the block-sized fields allocated per block. |
initialize | pass(self) | Initialize the equation common data. |
initialize_block_face_data | pass(self) | (Re)build the per-block face data on the current grid. |
fold_deposited_ghosts | pass(self) | Fold PIC deposits spilled into ghosts, locally and across ranks. |
initialize_pic_time_zero | pass(self) | Host-side PIC particle injection plus charge/current deposition at t=0. |
register_pic_deposition_on_coils | pass(self) | Keep the plasma current a PIC deposit put on coil cells. |
report_plasma_on_coils | pass(self) | Repeat at the end of the run the warning of plasma on coil cells. |
weight_pic_fields_time_zero | pass(self) | Host-side PIC field interpolation at t=0. |
save_pic_self_force_diagnostic_time_zero | pass(self) | Temporary PIC self-force diagnostic at t=0. |
save_energy_error | pass(self) | Save energy error history. |
save_energy_history | pass(self) | Save energy history. |
save_coils_current_diagnostics | pass(self) | Save instantaneous coil-current diagnostics. |
save_divergence_history | pass(self) | Save divergence history. |
save_grms_history | pass(self) | Save Grms history. |
save_magnetic_field_at_center_domain_history | pass(self) | Save domain-center B history. |
save_probes_history | pass(self) | Save the field probes history on its cadence. |
save_restart_files | pass(self) | Save restart files. |
save_slices | pass(self) | Save the slices on their cadence. |
save_xh5f | pass(self) | Save simulation data in XH5F format. |
initialize_coils | pass(self) | Initialize coils. |
compute_coils_current_time_zero | pass(self) | Host-side coil current initialization at t=0. |
impose_pic_fields_time_zero | pass(self) | Host-side elliptic initialization for PIC/current-driven fields. |
has_current_density | pass(self) | True if the current density is non-zero on any rank. |
set_rectangular_coil_x | pass(self) | Subroutine to set a rectangular coil source with +-x normal |
set_rectangular_coil_y | pass(self) | Subroutine to set a rectangular coil source with +-y normal |
set_rectangular_coil_z | pass(self) | Subroutine to set a rectangular coil source with +-z normal |
set_circular_coil_x | pass(self) | Subroutine to set a circular coil source with +-x normal |
set_circular_coil_y | pass(self) | Subroutine to set a circular coil source with +-y normal |
set_circular_coil_z | pass(self) | Subroutine to set a circular coil source with +-z normal |
set_solenoid_x | pass(self) | Subroutine to set a solenoid source with +-x normal |
set_solenoid_y | pass(self) | Subroutine to set a solenoid source with +-y normal |
set_solenoid_z | pass(self) | Subroutine to set a solenoid source with +-z normal |
set_helicon_coil | pass(self) | Subroutine to set a helicon coil source. |
compute_rectangular_current_flux_sides | pass(self) | Precompute rectangular side-current fluxes. |
compute_helicon_current_flux_segments | pass(self) | Precompute helicon segment-current fluxes. |
coupling_descriptor_forest | pass(self) | Report (scheme_time, rk_scheme, nv) for β admissibility. |
save_charge_conservation_diagnostic | pass(self) | Save PIC charge-continuity diagnostic. |
finalize_charge_conservation_diagnostic | pass(self) | Finalize PIC charge-continuity diagnostic. |
accumulate_charge_conservation_current | pass(self) | Accumulate weighted PIC stage div(J). |
initialize_charge_conservation_diagnostic | pass(self) | Initialize PIC charge-continuity diagnostic. |
allocate_gpu | pass(self) | Allocate GPU data. |
amr_update | pass(self) | Override: the common AMR update, then the device PML twins. |
rebalance | pass(self) | Override: the common rebalance (issue #123), then the device PML twins. |
copy_cpu_gpu | pass(self) | Copy data from CPU to GPU. |
copy_gpu_cpu | pass(self) | Copy data from GPU to CPU. |
destroy | pass(self) | Free device data owned by this realm. |
initialize_prism | pass(self) | Initialize PRISM equation. |
initialize_pml_fnl | pass(self) | (Re)build the device PML twins from the host PML. |
load_restart_files | pass(self) | Load restart files. |
save_residuals | pass(self) | Save residuals history. |
save_simulation_data | pass(self) | Save all simulation data. |
apply_fwl_correction | pass(self) | Apply fWLayer correction (if present) |
compute_coils_current | pass(self) | Compute current coils sources. |
register_pic_deposition_on_coils_dev | pass(self) | Keep the plasma current a deposit put on coil cells. |
mark_by_j_vec_total_variation | pass(self) | Override: device TV marker (common default error_stops). |
set_boundary_conditions | pass(self) | Set boundary conditions of equation. |
set_initial_conditions | pass(self) | Set initial conditions of equation. |
fold_deposited_ghosts_dev | pass(self) | Fold PIC deposits spilled into ghosts, locally and across ranks. |
gather_pic_fields_dev | pass(self) | Gather E, B at the particles (coherent matched gathers included). |
migrate_particles | pass(self) | Migrate particles between ranks (end of a time step). |
sync_particle_number | pass(self) | Align the device helpers to the local particle count. |
update_ghost | pass(self) | Update ghost cells and set boundary conditions. |
compute_curl_fd_dev | pass(self) | Compute curl of vector field by finite difference. |
compute_curl_fv_dev | pass(self) | Compute curl of vector field by finite volume. |
compute_derivative1_fd_dev | pass(self) | Compute derivative1 of scalar fields, finite difference schemes. |
compute_derivative1_fv_dev | pass(self) | Compute derivative1 of scalar fields, finite volume schemes. |
compute_derivative2_fd_dev | pass(self) | Compute derivative2 of scalar fields, finite difference schemes. |
compute_derivative2_fv_dev | pass(self) | Compute derivative2 of scalar fields, finite volume schemes. |
compute_derivative4_fd_dev | pass(self) | Compute derivative4 of scalar fields, finite difference schemes. |
compute_divergence_fd_dev | pass(self) | Compute divergence of vector field by finite difference. |
compute_divergence_fv_dev | pass(self) | Compute divergence of vector field by finite volume. |
compute_gradient_fd_dev | pass(self) | Compute gradient of scalar field, finite difference schemes. |
compute_gradient_fv_dev | pass(self) | Compute gradient of scalar field, finite volume schemes. |
compute_laplacian_fd_dev | pass(self) | Compute laplacian of scalar field, finite difference schemes. |
compute_laplacian_fv_dev | pass(self) | Compute laplacian of scalar field, finite volume schemes. |
apply_pml_fd_centered_ade_dev | pass(self) | Add ADE-PML terms to FD-centered residuals. |
compute_residuals_fd_centered_dev | pass(self) | Compute residuals, centered finite difference schemes. |
integrate_rk_ls_dev | pass(self) | RK classical low storage schemes. |
integrate_rk_ssp_dev | pass(self) | SSP RK schemes. |
initialize_app_forest | pass(self) | Template hook: the PRISM backend. |
restart_state_forest | pass(self) | Template hook: the state from the restart files. |
set_initial_state_forest | pass(self) | Template hook: the initial conditions. |
post_initial_state_forest | pass(self) | Template hook: ghosts, t0 diagnostics, history files. |
compute_local_dt_forest | pass(self) | Invoked by forest%compute_global_dt during the min reduction. |
advance_one_step_forest | pass(self) | Invoked by forest%evolve_one_step per realm per timestep. |
stages_per_step_forest | pass(self) | Number of integrator stages this realm exposes per step. |
open_step_forest | pass(self) | Per-step prologue (multi-realm path). |
begin_stage_forest | pass(self) | Begin one integrator stage on this realm (multi-realm path). |
end_stage_forest | pass(self) | End the stage: residuals + assignment (multi-realm path). |
close_step_forest | pass(self) | Per-step epilogue (multi-realm path). |
post_step_forest | pass(self) | Invoked by forest%post_step per realm per timestep. |
is_done_forest | pass(self) | Invoked by forest%is_done during the termination reduction. |
finalize_forest | pass(self) | Invoked by forest%finalize per realm at shutdown. |
finalize_mpi_forest | pass(self) | Process-global MPI finalize (mpih_fnl). |
initialize_process_context | pass(self) | Process-global MPI init (mpih_fnl + mpih), once. |
fill_seam_from_peer_forest | pass(self) | OpenACC device-direct copy of peer's GPU interior into self's GPU |
seam_ghosts_to_state | pass(self) | Copy the end_of_step seam ghosts into the stage state (#132). ghosts. |
pack_seam_cells_forest | pass(self) | Pack own cells of the cross-rank seam send rows. |
unpack_seam_cells_forest | pass(self) | Unpack the cross-rank seam receive rows into own ghosts. |
after_topology_build_forest | pass(self) | Refresh device-resident seam maps from freshly-built host maps. |
apply_reflux_to_stage_forest | pass(self) | Apply Berger-Colella reflux to self's RK stage buffer (FNL no-op). |
compute_dt | pass(self) | Compute time step. |
compute_plasma_frequencies | pass(self) | Plasma frequencies limiting the next PIC step. |
locate_particles_end_of_step | pass(self) | Particle-cell map of the final positions (#129 R7). |
compute_energy | pass(self) | Compute energy. |
compute_energy_error | pass(self) | Compute energy error. |
compute_grms | pass(self) | Compute Grms of the rotating magnetic-field amplitude. |
compute_magnetic_field_at_center_domain | pass(self) | Compute B at the domain center. |
sample_probes | pass(self) | Override: sample the probes on the device. |
sync_probes | pass(self) | Override: copy the probe stencils to the device. |
compute_max_divergence | pass(self) | Compute divergence of D, B and J fields for diagnostics. |
compute_max_divergence_outside_absorbing_layers | pass(self) | Host twin of the CPU t0 diagnostic. |
simulate | pass(self) | Perform the simulation. |
prism_fnl_object%load_fdv_from_file
Load FDV config from file.
fortran
subroutine load_fdv_from_file(self, file_parameters)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The equation. | |
file_parameters | type(file_ini) | in | Simulation parameters ini file handler. |
Call graph
prism_fnl_object%initialize_forest
Initialize this realm, the library template (issue #80 P3): the sequence every application shares, its steps delegated to the *_forest hooks below.
fortran
call self%initialize_app_forest(filename, realms_number) ! parse, build the library and app objects, the backend
if (self%io%restart) then
call self%restart_state_forest ! the state from the restart files
else
do i=1, self%initial_amr_iterations_forest() ! the initial state, then a regrid on it, n times
call self%set_initial_state_forest
call self%amr_update_initial_forest
enddo
call self%rebalance_initial_forest ! [amr].(balance_static)
call self%set_initial_state_forest ! the initial state on the final grid
call self%adam%make_comm_local_maps_ghost_bc ! the maps of the final grid
call self%reset_time_forest
endif
call self%post_initial_state_forest ! device push, ghosts, t0 diagnostics, history filesInvoked 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm. | |
filename | character(len=*) | in | Input parameters file name. | |
realms_number | integer(kind=I4P) | in | optional | Realm count in the forest. |
Call graph
prism_fnl_object%runtime_amr_forest
Return whether this realm regrids during the time loop (issue #74, runtime AMR).
The forest asks it before every regrid: with a realm that regrids, a multi-realm forest fills its seams before the realms mark and balances their marks across the seams (issue #110). Default: no runtime regridding, the behaviour of every app before #74; an app that regrids overrides it.
Returns: logical
fortran
function runtime_amr_forest(self) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The realm. |
Call graph
prism_fnl_object%regrid_forest
Regrid this realm if its cadence asks for it now (issue #74, runtime AMR).
Invoked by forest%regrid once per realm after post_step_forest, on committed q (no stage active). The realm marks its blocks, calls adam%amr_update and refreshes its grid-dependent state; regridded tells the forest whether the tree changed, so it rebuilds what it owns (the flux register). Default: never regrid.
fortran
subroutine regrid_forest(self, regridded)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm. | |
regridded | logical | out | True if the tree changed. |
Call graph
prism_fnl_object%regrid_begin_forest
Start a multi-realm regrid of this realm: active if its cadence asks for a regrid now (issue #110).
fortran
subroutine regrid_begin_forest(self, active)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm. | |
active | logical | out | This realm marks its blocks at this step. |
Call graph
prism_fnl_object%regrid_mark_forest
Mark the blocks of this realm for sweep sweep and gather the marks on its replicated tree (issue #110).
marked is false when the realm does not mark in this sweep (no regrid step, or more sweeps than its [amr] iters); the forest then clears its tree marks before balancing the seams.
fortran
subroutine regrid_mark_forest(self, sweep, marked)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm. | |
sweep | integer(kind=I4P) | in | Sweep of the regrid, from 1. | |
marked | logical | out | The realm marked its blocks. |
Call graph
prism_fnl_object%regrid_apply_forest
Adapt this realm to the marks on its replicated tree, as the forest balanced them (issue #110).
fortran
subroutine regrid_apply_forest(self, changed)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm. | |
changed | logical | out | The tree changed. |
Call graph
prism_fnl_object%regrid_end_forest
End a multi-realm regrid of this realm: refresh the state of the new grid, regridded if any sweep changed it.
fortran
subroutine regrid_end_forest(self, regridded)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm. | |
regridded | logical | out | The tree changed in some sweep. |
Call graph
prism_fnl_object%close_block_xh5f
Close XH5F file block.
fortran
subroutine close_block_xh5f(xh5f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
xh5f | type(xh5f_file_object) | inout | XH5F file handler. |
Call graph
prism_fnl_object%close_file_xh5f
Close XH5F file.
fortran
subroutine close_file_xh5f(xh5f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
xh5f | type(xh5f_file_object) | inout | XH5F file handler. |
Call graph
prism_fnl_object%open_block_xh5f
Open XH5F file block; length_scale multiplies the written block origin and spacing (output units of an application, e.g. FLUME [reference] output_units). The origin is the corner of the first stored cell: ngc_saved cells below the block's first interior cell, ngc_saved the ghost layers the caller writes (default all, ngc; 0 for the interior only, e.g. the restart snapshot, issue #109).
fortran
subroutine open_block_xh5f(self, xh5f, b, nijk, t, time, length_scale, ngc_saved)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The equation. | |
xh5f | type(xh5f_file_object) | inout | XH5F file handler. | |
b | integer(kind=I4P) | in | Block index. | |
nijk | integer(kind=I8P) | in | Blocks dimensions. | |
t | integer(kind=I4P) | in | optional | Time iteration. |
time | real(kind=R8P) | in | optional | Time. |
length_scale | real(kind=R8P) | in | optional | Scale of the written origin and spacing. |
ngc_saved | integer(kind=I4P) | in | optional | Ghost layers written (default ngc). |
Call graph
prism_fnl_object%open_file_xh5f
Open XH5F file.
fortran
subroutine open_file_xh5f(self, basename, xh5f, directory)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The equation. | |
basename | character(len=*) | in | Base name of output files. | |
xh5f | type(xh5f_file_object) | out | XH5F file handler. | |
directory | character(len=*) | in | optional | Directory name of output files. |
Call graph
prism_fnl_object%save_q_xh5f
Save ADAM in XH5F format.
fortran
subroutine save_q_xh5f(self, basename, q, q_name, directory, with_ghost, with_cell_morton, t, time)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The equation. | |
basename | character(len=*) | in | Base name of output files. | |
q | real(kind=R8P) | in | Q-vector variables [nv,ni,nj,nk,nb]. | |
q_name | character(len=*) | in | optional | Q-vector variables names [nv]. |
directory | character(len=*) | in | optional | Directory name of output files. |
with_ghost | logical | in | optional | Flag to save ghost cells. |
with_cell_morton | logical | in | optional | Flag to save Morton code also in cells. |
t | integer(kind=I4P) | in | optional | Time iteration. |
time | real(kind=R8P) | in | optional | Time. |
Call graph
prism_fnl_object%compute_curl_fd_extended
Compute curl of vector fields, div(q(ivar:ivar+2), using finite difference schemes.
fortran
subroutine compute_curl_fd_extended(self, hs, ivar, q, curl)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The equation. | |
hs | integer(kind=I4P) | in | FDV half stencil length. | |
ivar | integer(kind=I4P) | in | Start index of variable of q. | |
q | real(kind=R8P) | in | Field variables. | |
curl | real(kind=R8P) | inout | Curl. |
Call graph
prism_fnl_object%compute_gradient_fd_extended
Compute gradient of scalar variable q(ivar), finite difference schemes.
fortran
subroutine compute_gradient_fd_extended(self, hs, ivar, q, gradient)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The equation. | |
hs | integer(kind=I4P) | in | FDV half stencil length. | |
ivar | integer(kind=I4P) | in | Index of scalar variable of q. | |
q | real(kind=R8P) | in | Field variables. | |
gradient | real(kind=R8P) | inout | Gradient. |
Call graph
prism_fnl_object%amr_update_initial_forest
One initial regrid on the host (the FNL override of amr_update follows it with the device PML twins).
fortran
subroutine amr_update_initial_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_fnl_object%initial_amr_iterations_forest
The passes of initial conditions + regrid before the final initial conditions, ic%amr_iterations.
Returns: integer(kind=I4P)
fortran
function initial_amr_iterations_forest(self) result(n)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | in | The equation. |
Call graph
prism_fnl_object%rebalance_initial_forest
PRISM regrids at initialization only: balance the blocks by count, sibling sets split (issue #123).
fortran
subroutine rebalance_initial_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_fnl_object%reset_time_forest
The time and the step counter of a run from scratch to zero (dt is kept: the conserving PIC t0 path set it).
fortran
subroutine reset_time_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_fnl_object%mark_by_geometry
Mark blocks to be refined by a primitive axis-aligned box (deterministic, solution-independent).
A block is flagged TO_BE_REFINED iff its centroid lies inside [box_emin, box_emax] AND its current refinement level is below target_level. This is the AMR_GEO + AMR_GEO_PRIMITIVE_BOX marker: it produces a deterministic 2:1 coarse-fine jump at known coordinates, decoupled from the IB/solid geometry, for the issue #13 intra-realm AMR seam test fixture (#13 §7.5, M0).
fortran
subroutine mark_by_geometry(self, box_emin, box_emax, target_level, do_init)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. | |
box_emin | real(kind=R8P) | in | Box minimum corner. | |
box_emax | real(kind=R8P) | in | Box maximum corner. | |
target_level | integer(kind=I4P) | in | Refine blocks below this level. | |
do_init | logical | in | optional | Re-initialize refinements queries. |
Call graph
prism_fnl_object%allocate_common
Allocate common data.
fortran
subroutine allocate_common(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_fnl_object%compute_auxiliary_fields
Compute auxiliary fields.
fortran
subroutine compute_auxiliary_fields(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_fnl_object%compute_fields_number
Compute the block-sized fields PRISM allocates per block, the fields_number of the blocks budget.
Both backends allocate the same nb-sized arrays, on the host (CPU) or on the device (FNL), so one count serves both: q, dq, curl, divergence (4 nv), the time integrator's registers (SELAH's, stepper_stored_fields nv: the stage states and residuals, the residual register included, #132), the coils current density (3 per coil), the two PIC charge-continuity accumulators (only with a charge-conservation history), and the flux arrays of the scheme in use: the cell fluxes flxyz_c (9 nv) for FV and WENO, the face fluxes (3 nv, counted as full block fields) for FV only, none for centered FD (issue #112). Backend-only arrays are added by the backend estimate of initialize; face-local PML storage is not block-sized and is not counted. The FNL estimate also takes curl and divergence off the count: there they are host arrays only, recomputed from q at the saves (issue #112 C). Requires physics and numerics initialized and [runge_kutta] parsed into rk; loads the coils number (it needs no grid or field).
fortran
subroutine compute_fields_number(self, file_parameters, fields_number)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. | |
file_parameters | type(file_ini) | in | Simulation parameters ini file handler. | |
fields_number | integer(kind=I4P) | out | Block-sized fields allocated per block. |
Call graph
prism_fnl_object%initialize
Initialize the equation common data.
fortran
subroutine initialize(self, filename, memory_avail, nv, fields_number, verbose, L0)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | target | The equation. |
filename | character(len=*) | in | Input file name. | |
memory_avail | real(kind=R8P) | in | value | Memory available for single MPI process. |
nv | integer(kind=I4P) | in | optional | Number of field variables. |
fields_number | integer(kind=I4P) | in | optional | Block-sized fields per block (default: computed). |
verbose | logical | in | optional | Trigger verbose output. |
L0 | real(kind=R8P) | in | optional | Adimensionalization parameter. |
Call graph
prism_fnl_object%initialize_block_face_data
(Re)build the per-block face data on the current grid: the PEC faces of the external fields, the fWLayer ranges and the PML support with its RK storage. All are indexed by local block, so they must follow every change of the block set: the uniform refinement in initialize, each init-time amr_update, a restart (issue #95, P5.1). Every initializer called here resets its object first; the PML auxiliary state restarts from zero, as at any initialization.
fortran
subroutine initialize_block_face_data(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_fnl_object%fold_deposited_ghosts
Fold the PIC deposits that spilled into ghost cells back onto the cells they mirror, on this rank and across ranks, then refill the ghosts: the result equals a single-block deposit of the same particles. With one rank this is reduce_ghost_local alone. Collective.
fortran
subroutine fold_deposited_ghosts(self, q, v_first, v_last)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. | |
q | real(kind=R8P) | inout | Field variables. | |
v_first | integer(kind=I4P) | in | First variable to fold. | |
v_last | integer(kind=I4P) | in | Last variable to fold. |
Call graph
prism_fnl_object%initialize_pic_time_zero
Initialize PIC particles and deposit host-side charge/current sources at t=0.
fortran
subroutine initialize_pic_time_zero(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_fnl_object%register_pic_deposition_on_coils
Right after a PIC deposit into q: plasma current or charge on the coil support is no longer an error. The current is kept (committed or stage slot) and summed with the coil current by every later coil stamp of that state; the first occurrence is warned and repeated at the end of the run (report_plasma_on_coils). Collective (with coils): the overlap is reduced over the ranks and, when found, the ghosts of q are refreshed before the support (ghost cells included) is kept, so a ghost copy of a support cell carries its plasma current too. Without overlap q is untouched.
fortran
subroutine register_pic_deposition_on_coils(self, q, stage, check_current, check_charge, context)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. | |
q | real(kind=R8P) | inout | Deposited field. | |
stage | logical | in | q is a stage state (else the committed one). | |
check_current | logical | in | optional | The J rows hold a fresh deposit. |
check_charge | logical | in | optional | The charge row holds a fresh deposit. |
context | character(len=*) | in | optional | Call-site label. |
Call graph
prism_fnl_object%report_plasma_on_coils
End of the run: repeat the warning of plasma deposited on coil cells, with the first iteration (and its call site) and the last one over all the ranks. Collective.
fortran
subroutine report_plasma_on_coils(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | in | The equation. |
Call graph
prism_fnl_object%weight_pic_fields_time_zero
Interpolate initialized fields at particle positions at t=0.
fortran
subroutine weight_pic_fields_time_zero(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_fnl_object%save_pic_self_force_diagnostic_time_zero
Temporary diagnostic for single-particle PIC self-force analysis.
fortran
subroutine save_pic_self_force_diagnostic_time_zero(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | in |
Call graph
prism_fnl_object%save_energy_error
Save energy error history.
fortran
subroutine save_energy_error(self, is_to_open, is_to_close)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. | |
is_to_open | logical | in | optional | Flag to open file before first saving. |
is_to_close | logical | in | optional | Flag to close file after last saving. |
Call graph
prism_fnl_object%save_energy_history
Save energy history.
fortran
subroutine save_energy_history(self, is_to_open, is_to_close)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. | |
is_to_open | logical | in | optional | Flag to open file before first saving. |
is_to_close | logical | in | optional | Flag to close file after last saving. |
Call graph
prism_fnl_object%save_coils_current_diagnostics
Save instantaneous coil-current diagnostics.
fortran
subroutine save_coils_current_diagnostics(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_fnl_object%save_divergence_history
Save divergence history.
fortran
subroutine save_divergence_history(self, is_to_open, is_to_close, div_D, div_B, div_J, current_solver_residual)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. | |
is_to_open | logical | in | optional | Flag to open file before first saving. |
is_to_close | logical | in | optional | Flag to close file after last saving. |
div_D | real(kind=R8P) | in | Maximum of divergence of D field. | |
div_B | real(kind=R8P) | in | Maximum of divergence of B | |
div_J | real(kind=R8P) | in | Maximum of divergence of J field. | |
current_solver_residual | real(kind=R8P) | in | optional | Maximum current linear-solve residual. |
Call graph
prism_fnl_object%save_grms_history
Save Grms history.
fortran
subroutine save_grms_history(self, is_to_open, is_to_close)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. | |
is_to_open | logical | in | optional | Flag to open file before first saving. |
is_to_close | logical | in | optional | Flag to close file after last saving. |
Call graph
prism_fnl_object%save_magnetic_field_at_center_domain_history
Save domain-center magnetic-field history.
fortran
subroutine save_magnetic_field_at_center_domain_history(self, is_to_open, is_to_close)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. | |
is_to_open | logical | in | optional | Flag to open file before first saving. |
is_to_close | logical | in | optional | Flag to close file after last saving. |
Call graph
prism_fnl_object%save_probes_history
Save the field probes history on its cadence ([probes] save_every and the last step); collective.
With is_to_open the stencils are built on the current grid, synced with the backend and the files opened. The probes sample q as stored: the external fields, if any, are not added.
fortran
subroutine save_probes_history(self, is_to_open)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. | |
is_to_open | logical | in | optional | Flag to open the files before the first saving. |
Call graph
prism_fnl_object%save_restart_files
Save restart files.
fortran
subroutine save_restart_files(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_fnl_object%save_slices
Save the slices (library slices_object, [slices] / [slice_N]) on their cadence, one file per field set: <basename>-slice_NN-<it>.mat holds q (the total field when external fields are applied, as the XH5F output), <basename>-curl-slice_NN-<it>.mat and <basename>-div-slice_NN-<it>.mat the curl and divergence fields when their XH5F output is enabled ([IO] save_curl_fields, save_divergence_fields). The caller has refreshed the ghost cells of the host q and computed the auxiliary fields. These are computed on the interior cells only, so their intra-realm ghost cells are refreshed here: the stencil of a point in the half cell next to a block face reads them. Their physical-boundary ghost cells are not set: a point in the half cell next to the domain boundary interpolates with them.
fortran
subroutine save_slices(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_fnl_object%save_xh5f
Save simulation data in HDF5 format.
fortran
subroutine save_xh5f(self, output_basename, with_ghost)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. | |
output_basename | character(len=*) | in | optional | Output basename. |
with_ghost | logical | in | optional | Flag to save ghost cells. |
Call graph
prism_fnl_object%initialize_coils
Initialize coils.
fortran
subroutine initialize_coils(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_fnl_object%compute_coils_current_time_zero
Compute coils current sources on the host at time t=0.
fortran
subroutine compute_coils_current_time_zero(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_fnl_object%impose_pic_fields_time_zero
Compute initial condition for the fields in presence of plasma or current sources.
The electric field (PIC): D(G) phi = -rho/eps, then D <- D - eps G phi. The magnetic field: D(G) A_d = -mu J_d per component, then B <- B + curl A. D(G) is PRISM's own operator, the order-p centred derivative composed with itself (fdv_order), so the corrected field satisfies div D = rho to round-off with PRISM's divergence (issue #84, E3a). The solves run by FLAIL's FFT solver (E3b); an exact/open face holds the free-space potential of the source in its ghosts, summed over the whole domain (E3c). A refined grid is refused: the wide operator across 2:1 faces is not defined yet (E7).
The correction is written in the interior cells only: the caller refreshes the ghosts of the corrected field (exchange and boundary conditions, refresh_time_zero_ghosts of each backend), as every stage does before reading them. The former extension of the gradient/curl into the first ngc/2 ghost layers read the potential ngc/2 + hs layers deep, which tied ngc to 2 hs (issue #112, the ghost cells of FD6) for values every stage overwrites.
fortran
subroutine impose_pic_fields_time_zero(self, ivar)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. | |
ivar | integer(kind=I4P) | in | Variable (start) index in q. |
Call graph
prism_fnl_object%has_current_density
Return true if the current density (host q) is non-zero on any rank; every rank must call it. It decides whether the elliptic magnetic-field initialization runs. A rank-local test let the ranks holding current enter that solve while the others skipped it, and the solve's ghost exchange then waited forever (issue #84).
Returns: logical
fortran
function has_current_density(self) result(has)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | in | The equation. |
Call graph
prism_fnl_object%set_rectangular_coil_x
Set rectangular coil with normal direction parallel to x.
fortran
subroutine set_rectangular_coil_x(self, n, verse)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | Cpu object. | |
n | integer(kind=I4P) | in | Coil number. | |
verse | real(kind=R8P) | in | Coil normal direction, +1=+x, -1=-x. |
Call graph
prism_fnl_object%set_rectangular_coil_y
Set rectangular coil with normal direction parallel to y.
fortran
subroutine set_rectangular_coil_y(self, n, verse)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | Cpu object. | |
n | integer(kind=I4P) | in | Coil number. | |
verse | real(kind=R8P) | in | Coil normal direction, +1=+y, -1=-y. |
Call graph
prism_fnl_object%set_rectangular_coil_z
Set rectangular coil with normal direction parallel to z.
fortran
subroutine set_rectangular_coil_z(self, n, verse)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | Cpu object. | |
n | integer(kind=I4P) | in | Coil number. | |
verse | real(kind=R8P) | in | Coil normal direction, +1=+z, -1=-z. |
Call graph
prism_fnl_object%set_circular_coil_x
Set circular coil with normal direction parallel to x.
fortran
subroutine set_circular_coil_x(self, n, verse)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | Cpu object. | |
n | integer(kind=I4P) | in | Coil number. | |
verse | real(kind=R8P) | in | Coil normal direction, +1=+x, -1=-x. |
Call graph
prism_fnl_object%set_circular_coil_y
Set circular coil with normal direction parallel to y.
fortran
subroutine set_circular_coil_y(self, n, verse)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | Cpu object. | |
n | integer(kind=I4P) | in | Coil number. | |
verse | real(kind=R8P) | in | Coil normal direction, +1=+y, -1=-y. |
Call graph
prism_fnl_object%set_circular_coil_z
Set circular coil with normal direction parallel to z.
fortran
subroutine set_circular_coil_z(self, n, verse)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | Cpu object. | |
n | integer(kind=I4P) | in | Coil number. | |
verse | real(kind=R8P) | in | Coil normal direction, +1=+z, -1=-z. |
Call graph
prism_fnl_object%set_solenoid_x
Set solenoid with axis direction parallel to x.
fortran
subroutine set_solenoid_x(self, n, verse)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | Cpu object. | |
n | integer(kind=I4P) | in | Coil number. | |
verse | real(kind=R8P) | in | Solenoid axis direction, +1=+x, -1=-x. |
Call graph
prism_fnl_object%set_solenoid_y
Set solenoid with axis direction parallel to y.
fortran
subroutine set_solenoid_y(self, n, verse)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | Cpu object. | |
n | integer(kind=I4P) | in | Coil number. | |
verse | real(kind=R8P) | in | Solenoid axis direction, +1=+y, -1=-y. |
Call graph
prism_fnl_object%set_solenoid_z
Set solenoid with axis direction parallel to z.
fortran
subroutine set_solenoid_z(self, n, verse)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | Cpu object. | |
n | integer(kind=I4P) | in | Coil number. | |
verse | real(kind=R8P) | in | Solenoid axis direction, +1=+z, -1=-z. |
Call graph
prism_fnl_object%set_helicon_coil
Set helicon coil.
fortran
subroutine set_helicon_coil(self, n)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | Cpu object. | |
n | integer(kind=I4P) | in | Coil number. |
Call graph
prism_fnl_object%compute_rectangular_current_flux_sides
Numerically measure the current crossing each local side-normal section of a rectangular coil.
fortran
subroutine compute_rectangular_current_flux_sides(self, coil_id, i_dir_n, i_dir_a, i_dir_b, a1, a2, b1, b2, verse)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. | |
coil_id | integer(kind=I4P) | in | Coil index. | |
i_dir_n | integer(kind=I4P) | in | Coil-normal direction. | |
i_dir_a | integer(kind=I4P) | in | First in-plane direction. | |
i_dir_b | integer(kind=I4P) | in | Second in-plane direction. | |
a1 | real(kind=R8P) | in | Bounds along the local a direction. | |
a2 | real(kind=R8P) | in | Bounds along the local a direction. | |
b1 | real(kind=R8P) | in | Bounds along the local b direction. | |
b2 | real(kind=R8P) | in | Bounds along the local b direction. | |
verse | real(kind=R8P) | in | Coil orientation sign. |
Call graph
prism_fnl_object%compute_helicon_current_flux_segments
Numerically measure the current crossing each local segment-normal section.
fortran
subroutine compute_helicon_current_flux_segments(self, coil_id)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. | |
coil_id | integer(kind=I4P) | in | Coil index. |
Call graph
prism_fnl_object%coupling_descriptor_forest
Report this realm's coupling descriptor for β admissibility.
Returns (numerics%scheme_time, rk%scheme, physics%nv). β admits a seam between two realms iff all three values agree. Spatial operator (numerics%scheme_space) is intentionally NOT in the descriptor — β exists precisely to support different spatial operators per realm.
Provided on prism_common_object so both prism_cpu_object and prism_fnl_object inherit a single implementation.
fortran
subroutine coupling_descriptor_forest(self, scheme_time, rk_scheme, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | in | The realm. | |
scheme_time | character(len=:) | out | allocatable | Time-integration family tag ("runge_kutta", "leapfrog", ...). |
rk_scheme | character(len=:) | out | allocatable | Within-family scheme tag ("runge-kutta-ssp-54", ...). |
nv | integer(kind=I4P) | out | Number of conserved variables on this realm. |
Call graph
prism_fnl_object%seam_ghosts_to_state
Copy the seam ghosts of q into the stage state u, for the peer slots of the given cadence (#132 rule 1).
SELAH's Butcher form keeps the state of the active stage in one register and never writes a ghost cell: called when each stage opens, after the stepper built its state, it gives that stage the peer state of the step's alpha fill, the peer state at the start of the step (the alpha cadence).
fortran
subroutine seam_ghosts_to_state(maps, cadence, ngc, q, u)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
maps | type(maps_object) | in | Maps of the realm owning the ghosts. | |
cadence | integer(kind=I4P) | in | Cadence of the slots copied. | |
ngc | integer(kind=I4P) | in | Ghost cells number. | |
q | real(kind=R8P) | in | Committed state (v, i, j, k, b). | |
u | real(kind=R8P) | inout | Stage state (v, i, j, k, b). |
Call graph
Interfaces
compute_curl_interface_dev
compute_derivative1_interface_dev
compute_derivative2_interface_dev
compute_derivative4_interface_dev
compute_divergence_interface_dev
compute_gradient_interface_dev
compute_laplacian_interface_dev
compute_residuals_interface_dev
integrate_interface_dev
Subroutines
destroy
Free device data owned by this PRISM FNL realm.
fortran
subroutine destroy(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
free_prism_core_gpu
Free raw device buffers allocated directly by prism_fnl_object%allocate_gpu.
fortran
subroutine free_prism_core_gpu(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
estimate_backend_memory_fnl
Device memory of the PIC that the block fields of compute_fields_number do not count, estimated from the input before the grid exists (issue #112), so that the blocks budget leaves it free. Set as prism_common_object%estimate_backend_memory before the common initialize.
extra_fields: the correction to the block fields of compute_fields_number on the device, which may be negative: -2 nv for curl and divergence, host arrays only in FNL (issue #112 C), +1 for j_vec_tv_gpu with an AMR_TV marker; plus, under PIC, the fields on the block slots, from the functions their objects allocate by (issue #130, 8-bis): plasma_frequencies_block_fields (wp2_gpu) and conserving_layout%slot_fields (gq_gpu, 6, coherent gather; gather_gpu, nv, with external fields). reserved_memory: the particle arrays, sized on the particle capacity of a rank, [PIC].(particle_capacity_factor) (q_pic_gpu, pic_fields_gpu, neighbour_list_gpu, the time scheme stages, the migration buffers, the conserving histories), and the virtual block of the conserving current, the whole domain at the finest uniform level. The bytes are those the objects allocate, from the functions they allocate by (issue #130): pic_fnl_device_bytes, the SELAH registers of the particles' companion and conserving_layout%device_bytes. PML storage and the runtime context are left to the [amr].(memory_fraction) headroom.
fortran
subroutine estimate_backend_memory_fnl(physics, file_parameters, rk_scheme, extra_fields, reserved_memory)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
physics | type(prism_physics_object) | in | Physics (initialized). | |
file_parameters | type(file_ini) | inout | Simulation parameters ini file handler. | |
rk_scheme | character(len=*) | in | Runge-Kutta scheme (parsed by ts). | |
extra_fields | integer(kind=I4P) | out | Correction to the block-sized fields per block. | |
reserved_memory | real(kind=R8P) | out | Memory of the allocations not block-sized (GB). |
Call graph
allocate_gpu
Allocate GPU data.
fortran
subroutine allocate_gpu(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
copy_cpu_gpu
Copy data from CPU to GPU.
fortran
subroutine copy_cpu_gpu(self, verbose)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
verbose | logical | in | optional | Trigger verbose output. |
Call graph
copy_gpu_cpu
Copy data from GPU to CPU.
fortran
subroutine copy_gpu_cpu(self, compute_copy_q_aux, copy_phi, verbose)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
compute_copy_q_aux | logical | in | optional | Flag to compute auxiliary variables. |
copy_phi | logical | in | optional | Copy also phi. |
verbose | logical | in | optional | Trigger verbose output. |
Call graph
initialize_prism
Initialize PRISM equation.
fortran
subroutine initialize_prism(self, filename, realms_number)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | target | The equation. |
filename | character(len=*) | in | Input file name. | |
realms_number | integer(kind=I4P) | in | optional | Forest realm count; divides the per-device budget (default 1). |
Call graph
initialize_pml_fnl
(Re)build the device PML twins (compact face storage) from the host PML and the faces' SELAH companions on the device arrays (#134 D5): at initialization and whenever the host PML is rebuilt on a new block set (issue #95, P5.1). Both initializers destroy their state first.
fortran
subroutine initialize_pml_fnl(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
amr_update
Do AMR update: the common host update (which rebuilds the per-block face data on a changed grid), then the device PML twins from the rebuilt host PML (issue #95, P5.1). The device fields and maps follow in initialize_forest.
fortran
subroutine amr_update(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
rebalance
Balance the static grid's blocks by count (issue #123): the common host rebalance (which rebuilds the per-block face data), then the device PML twins from the rebuilt host PML, as amr_update does. The device fields and maps follow in initialize_forest.
fortran
subroutine rebalance(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
load_restart_files
Save restart files.
fortran
subroutine load_restart_files(self, t, time)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
t | integer(kind=I4P) | out | Time iteration. | |
time | real(kind=R8P) | out | Time. |
Call graph
save_residuals
Save residuals history.
fortran
subroutine save_residuals(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
save_simulation_data
Save all simulation data.
fortran
subroutine save_simulation_data(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
apply_fwl_correction
Apply correction if a fWL is present.
fortran
subroutine apply_fwl_correction(self, q_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
q_gpu | real(kind=R8P) | inout | Conservative variables. |
Call graph
compute_coils_current
Compute current coils sources.
fortran
subroutine compute_coils_current(self, q_gpu, gamm)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The equation. | |
q_gpu | real(kind=R8P) | inout | Conservative variables. | |
gamm | real(kind=R8P) | in | optional | RK coefficient. |
Call graph
register_pic_deposition_on_coils_dev
Device twin of prism_common_object%register_pic_deposition_on_coils: right after a PIC deposit into q_gpu, plasma current or charge on the coil support is no longer an error. The current is kept (committed or stage slot) and summed with the coil current by every later coil stamp of that state; the first occurrence is warned and repeated at the end of the run (report_plasma_on_coils). Collective (with coils): the overlap is reduced over the ranks and, when found, the ghosts of q_gpu are refreshed before the support (ghost cells included) is kept. Without overlap q_gpu is untouched.
fortran
subroutine register_pic_deposition_on_coils_dev(self, q_gpu, stage, check_current, check_charge, context)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
q_gpu | real(kind=R8P) | inout | Deposited field. | |
stage | logical | in | q_gpu is a stage state (else the committed one). | |
check_current | logical | in | optional | The J rows hold a fresh deposit. |
check_charge | logical | in | optional | The charge row holds a fresh deposit. |
context | character(len=*) | in | optional | Call-site label. |
Call graph
mark_by_j_vec_total_variation
Mark blocks to be refined/derefined by the value of total variation of j_vec, FNL (device) backend.
Device twin of prism_cpu_object%mark_by_j_vec_total_variation. The TV reduction runs on the device, where j_vec_gpu lives: routing it through the host implementation would cost a full transposed D2H of the largest array in the run to produce one scalar per block. Only tv(1:blocks_number) crosses back, and the refinement decision stays on the host because the tree/AMR state is host-side anyway.
Contiguity discipline (adam_fnl_fdv_operators_library): the device operators take PRE-GATHERED contiguous 1D stencils, they never slice inside an acc routine seq. Hence the nine qs* buffers below, mirroring compute_curl_fd_dev_kernel. dxyz_b is a private copy for the same reason as issue #26 G1.b: the strided section dxyz_gpu(b,1:3) materializes a compiler temporary that is NOT privatized and threads race on it.
Two deliberate divergences from the host original, both behaviour-preserving today:
- The host reduces via realm_object%compute_block_total_variation, which is parameterised on
ivarand reads components (ivar, ivar+1, ivar+2). The only call site passes ivar=1, so the kernel below gathers components 1..3 of j_vec directly rather than carrying an offset through nine stencil gathers. Restore the parameter here if a caller ever needs a vector field that does not start at component 1. tot_var_fieldis stamped intoj_vec_tv_gpu(one field, allocated only with an AMR_TV marker, issue #112 C), which copy_gpu_cpu copies into the host divergence row 4 (totvar), the row the host marker fills.
j_vec_gpu ghosts are valid without any exchange: set_coil writes J_vec over the full ghosted extent (1-ngc:n+ngc) with explicit face-slab ghost reconstruction, and set_initial_conditions pushes it to device via copy_cpu_gpu immediately before every amr_update in the IC/AMR loop.
fortran
subroutine mark_by_j_vec_total_variation(self, tv_tol, delta_type, delta_fine, delta_coarse, threshold, do_init)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
tv_tol | real(kind=R8P) | in | Total variation tolerance value. | |
delta_type | character(len=*) | in | Delta criterion type. | |
delta_fine | real(kind=R8P) | in | Maximum cell delta in fine grids. | |
delta_coarse | real(kind=R8P) | in | Minimum cell delta in coarse grids. | |
threshold | real(kind=R8P) | in | optional | Threshold for sphere proximity. |
do_init | logical | in | optional | Re-initialize refinements queries. |
Call graph
set_boundary_conditions
Set boundary conditions of equation.
fortran
subroutine set_boundary_conditions(self, q_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The equation. | |
q_gpu | real(kind=R8P) | inout | Conservative variables. |
Call graph
set_initial_conditions
Set initial conditions of field.
fortran
subroutine set_initial_conditions(self, is_restart)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
is_restart | logical | in | Branching sentinel for restart/non restart path. |
Call graph
update_ghost
Update ghost cells (intra-realm only).
Inter-realm seam ghost cells are filled by the forest's Phase 2 seam exchange (between assemble and evaluate) via fill_seam_from_peer_forest, NOT here. The legacy realm(:) optional dummy and the exchange_inter_realm_halos_forest call have been retired by the agnostic-dummy seam redesign.
fortran
subroutine update_ghost(self, q_gpu, step, s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
q_gpu | real(kind=R8P) | inout | Conservative variables. | |
step | integer(kind=I4P) | in | optional | Step to be performed in async comp. |
s | integer(kind=I4P) | in | optional | Stage counter. |
Call graph
compute_curl_fd_dev
Compute curl of vector fields, div(q(ivar:ivar+2), using finite difference schemes.
fortran
subroutine compute_curl_fd_dev(self, ivar, q_gpu, curl_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The equation. | |
ivar | integer(kind=I4P) | in | Start index of variable of q. | |
q_gpu | real(kind=R8P) | in | Field variables. | |
curl_gpu | real(kind=R8P) | inout | Curl. |
Call graph
compute_curl_fv_dev
Compute curl of vector fields, div(q(ivar:ivar+2), using finite volume schemes.
fortran
subroutine compute_curl_fv_dev(self, ivar, q_gpu, curl_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The equation. | |
ivar | integer(kind=I4P) | in | Start index of variable of q. | |
q_gpu | real(kind=R8P) | in | Field variables. | |
curl_gpu | real(kind=R8P) | inout | Curl. |
compute_derivative1_fd_dev
Compute derivative1 of scalar fields, dq(ivar)/ds, using finite difference schemes.
fortran
subroutine compute_derivative1_fd_dev(self, dir, ivar, q_gpu, dq_ds_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The equation. | |
dir | integer(kind=I4P) | in | Direction, 1=X, 2=Y, 3=Z. | |
ivar | integer(kind=I4P) | in | Start index of variable of q. | |
q_gpu | real(kind=R8P) | in | Field variables. | |
dq_ds_gpu | real(kind=R8P) | inout | Derivative1, dq/ds. |
compute_derivative1_fv_dev
Compute derivative1 of scalar fields, dq(ivar)/ds, using finite volume schemes.
fortran
subroutine compute_derivative1_fv_dev(self, dir, ivar, q_gpu, dq_ds_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The equation. | |
dir | integer(kind=I4P) | in | Direction, 1=X, 2=Y, 3=Z. | |
ivar | integer(kind=I4P) | in | Start index of variable of q. | |
q_gpu | real(kind=R8P) | in | Field variables. | |
dq_ds_gpu | real(kind=R8P) | inout | Derivative1, dq/ds. |
compute_derivative2_fd_dev
Compute derivative2 of scalar fields, d2q(ivar)/ds2, using finite difference schemes.
fortran
subroutine compute_derivative2_fd_dev(self, dir, ivar, q_gpu, d2q_ds2_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The equation. | |
dir | integer(kind=I4P) | in | Direction, 1=X, 2=Y, 3=Z. | |
ivar | integer(kind=I4P) | in | Start index of variable of q. | |
q_gpu | real(kind=R8P) | in | Field variables. | |
d2q_ds2_gpu | real(kind=R8P) | inout | Derivative2, d2q/ds2. |
compute_derivative2_fv_dev
Compute derivative2 of scalar fields, d2q(ivar)/ds2, using finite volume schemes.
fortran
subroutine compute_derivative2_fv_dev(self, dir, ivar, q_gpu, d2q_ds2_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The equation. | |
dir | integer(kind=I4P) | in | Direction, 1=X, 2=Y, 3=Z. | |
ivar | integer(kind=I4P) | in | Start index of variable of q. | |
q_gpu | real(kind=R8P) | in | Field variables. | |
d2q_ds2_gpu | real(kind=R8P) | inout | Derivative2, d2q/ds2. |
compute_derivative4_fd_dev
Compute derivative4 of scalar fields, d4q(ivar)/ds4, using finite difference schemes.
fortran
subroutine compute_derivative4_fd_dev(self, dir, ivar, q_gpu, d4q_ds4_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The equation. | |
dir | integer(kind=I4P) | in | Direction, 1=X, 2=Y, 3=Z. | |
ivar | integer(kind=I4P) | in | Start index of variable of q. | |
q_gpu | real(kind=R8P) | in | Field variables. | |
d4q_ds4_gpu | real(kind=R8P) | inout | Derivative4, d4q/ds4. |
compute_divergence_fd_dev
Compute divergence of vector fields, div(q(ivar:ivar+2), using finite difference schemes. Directly computes divergence from transposed GPU layout (b,i,j,k,v).
fortran
subroutine compute_divergence_fd_dev(self, ivar, ovar, q_gpu, divergence_gpu, maxdiv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The equation. | |
ivar | integer(kind=I4P) | in | Start index of field of q. | |
ovar | integer(kind=I4P) | in | Output index in div. | |
q_gpu | real(kind=R8P) | in | Field variables. | |
divergence_gpu | real(kind=R8P) | inout | Divergence. | |
maxdiv | real(kind=R8P) | out | optional | Max divergence, for checking. |
Call graph
compute_divergence_fv_dev
Compute divergence of vector fields, div(q(ivar:ivar+2), using finite volume schemes. Directly computes divergence from transposed GPU layout (b,i,j,k,v).
fortran
subroutine compute_divergence_fv_dev(self, ivar, ovar, q_gpu, divergence_gpu, maxdiv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The equation. | |
ivar | integer(kind=I4P) | in | Start index of field of q. | |
ovar | integer(kind=I4P) | in | Output index in divergence. | |
q_gpu | real(kind=R8P) | in | Field variables. | |
divergence_gpu | real(kind=R8P) | inout | Divergence. | |
maxdiv | real(kind=R8P) | out | optional | Max divergence, for checking. |
compute_gradient_fd_dev
Compute gradient of scalar variable q(ivar), finite difference schemes.
fortran
subroutine compute_gradient_fd_dev(self, ivar, q_gpu, gradient_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The equation. | |
ivar | integer(kind=I4P) | in | Index of scalar var of q. | |
q_gpu | real(kind=R8P) | in | Field variables. | |
gradient_gpu | real(kind=R8P) | inout | Gradient. |
compute_gradient_fv_dev
Compute gradient of scalar variable q(ivar), finite volume schemes.
fortran
subroutine compute_gradient_fv_dev(self, ivar, q_gpu, gradient_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The equation. | |
ivar | integer(kind=I4P) | in | Index of scalar var of q. | |
q_gpu | real(kind=R8P) | in | Field variables. | |
gradient_gpu | real(kind=R8P) | inout | Gradient. |
compute_laplacian_fd_dev
Compute laplacian of scalar variable q(ivar), finite difference schemes.
fortran
subroutine compute_laplacian_fd_dev(self, ivar, q_gpu, laplacian_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The equation. | |
ivar | integer(kind=I4P) | in | Index of scalar variable of q. | |
q_gpu | real(kind=R8P) | in | Field variables. | |
laplacian_gpu | real(kind=R8P) | inout | Gradient. |
compute_laplacian_fv_dev
Compute laplacian of scalar variable q(ivar), finite volume schemes.
fortran
subroutine compute_laplacian_fv_dev(self, ivar, q_gpu, laplacian_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The equation. | |
ivar | integer(kind=I4P) | in | Index of scalar variable of q. | |
q_gpu | real(kind=R8P) | in | Field variables. | |
laplacian_gpu | real(kind=R8P) | inout | Gradient. |
compute_residuals_fd_centered_dev
Compute residuals of equation, space operator, centered finite difference schemes.
fortran
subroutine compute_residuals_fd_centered_dev(self, q_gpu, dq_gpu, s, flux_register)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
q_gpu | real(kind=R8P) | inout | Conservative variables. | |
dq_gpu | real(kind=R8P) | inout | Residuals. | |
s | integer(kind=I4P) | in | optional | Stage counter. |
flux_register | class(flux_register_object) | inout | optional | Forest's flux register (interface parity; the FD path does not accumulate seam fluxes). |
Call graph
apply_pml_fd_centered_ade_dev
Add ADE-PML source terms to the FD-centered Maxwell residuals and build the device-side auxiliary RHSs.
fortran
subroutine apply_pml_fd_centered_ade_dev(self, q_gpu, dq_gpu, s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | ||
q_gpu | real(kind=R8P) | in | ||
dq_gpu | real(kind=R8P) | inout | ||
s | integer(kind=I4P) | in | optional |
Call graph
fd_centered_plain_dev_kernel
Centered-FD Maxwell residual without hyperbolic cleaning.
fortran
subroutine fd_centered_plain_dev_kernel(ni, nj, nk, ngc, blocks_number, var_jx, var_jy, var_jz, s1, inv_mu_scale, inv_eps_scale, dxyz_gpu, q_gpu, dq_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
ngc | integer(kind=I4P) | in | ||
blocks_number | integer(kind=I4P) | in | ||
var_jx | integer(kind=I4P) | in | ||
var_jy | integer(kind=I4P) | in | ||
var_jz | integer(kind=I4P) | in | ||
s1 | integer(kind=I4P) | in | ||
inv_mu_scale | real(kind=R8P) | in | ||
inv_eps_scale | real(kind=R8P) | in | ||
dxyz_gpu | real(kind=R8P) | in | ||
q_gpu | real(kind=R8P) | in | ||
dq_gpu | real(kind=R8P) | inout |
Call graph
fd_centered_phi_dev_kernel
Centered-FD Maxwell residual with phi cleaning only.
fortran
subroutine fd_centered_phi_dev_kernel(ni, nj, nk, ngc, blocks_number, var_jx, var_jy, var_jz, s1, inv_mu_scale, inv_eps_scale, chi_wave, alpha, ivar_phi, rho_ivar, use_rho, dxyz_gpu, q_gpu, dq_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
ngc | integer(kind=I4P) | in | ||
blocks_number | integer(kind=I4P) | in | ||
var_jx | integer(kind=I4P) | in | ||
var_jy | integer(kind=I4P) | in | ||
var_jz | integer(kind=I4P) | in | ||
s1 | integer(kind=I4P) | in | ||
inv_mu_scale | real(kind=R8P) | in | ||
inv_eps_scale | real(kind=R8P) | in | ||
chi_wave | real(kind=R8P) | in | ||
alpha | real(kind=R8P) | in | ||
ivar_phi | integer(kind=I4P) | in | ||
rho_ivar | integer(kind=I4P) | in | ||
use_rho | integer(kind=I4P) | in | ||
dxyz_gpu | real(kind=R8P) | in | ||
q_gpu | real(kind=R8P) | in | ||
dq_gpu | real(kind=R8P) | inout |
Call graph
fd_centered_psi_dev_kernel
Centered-FD Maxwell residual with psi cleaning only.
fortran
subroutine fd_centered_psi_dev_kernel(ni, nj, nk, ngc, blocks_number, var_jx, var_jy, var_jz, s1, inv_mu_scale, inv_eps_scale, chi_wave, alpha, ivar_psi, dxyz_gpu, q_gpu, dq_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
ngc | integer(kind=I4P) | in | ||
blocks_number | integer(kind=I4P) | in | ||
var_jx | integer(kind=I4P) | in | ||
var_jy | integer(kind=I4P) | in | ||
var_jz | integer(kind=I4P) | in | ||
s1 | integer(kind=I4P) | in | ||
inv_mu_scale | real(kind=R8P) | in | ||
inv_eps_scale | real(kind=R8P) | in | ||
chi_wave | real(kind=R8P) | in | ||
alpha | real(kind=R8P) | in | ||
ivar_psi | integer(kind=I4P) | in | ||
dxyz_gpu | real(kind=R8P) | in | ||
q_gpu | real(kind=R8P) | in | ||
dq_gpu | real(kind=R8P) | inout |
Call graph
fd_centered_phi_psi_dev_kernel
Centered-FD Maxwell residual with phi/psi cleaning.
fortran
subroutine fd_centered_phi_psi_dev_kernel(ni, nj, nk, ngc, blocks_number, var_jx, var_jy, var_jz, s1, inv_mu_scale, inv_eps_scale, chi_wave, alpha, ivar_phi, ivar_psi, rho_ivar, use_rho, dxyz_gpu, q_gpu, dq_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
ngc | integer(kind=I4P) | in | ||
blocks_number | integer(kind=I4P) | in | ||
var_jx | integer(kind=I4P) | in | ||
var_jy | integer(kind=I4P) | in | ||
var_jz | integer(kind=I4P) | in | ||
s1 | integer(kind=I4P) | in | ||
inv_mu_scale | real(kind=R8P) | in | ||
inv_eps_scale | real(kind=R8P) | in | ||
chi_wave | real(kind=R8P) | in | ||
alpha | real(kind=R8P) | in | ||
ivar_phi | integer(kind=I4P) | in | ||
ivar_psi | integer(kind=I4P) | in | ||
rho_ivar | integer(kind=I4P) | in | ||
use_rho | integer(kind=I4P) | in | ||
dxyz_gpu | real(kind=R8P) | in | ||
q_gpu | real(kind=R8P) | in | ||
dq_gpu | real(kind=R8P) | inout |
Call graph
compute_residuals_fv_centered_dev
Compute residuals, space operator, centered finite volume scheme — FNL device backend (issue #23 R2). 1:1 structural mirror of prism_cpu_object%compute_residuals_fv_centered: ghost refresh on q, pointwise Maxwell fluxes at ALL cells (incl. ghosts) into flxyz_c_gpu, three staggered face-reconstruction sweeps into fl{x,y,z}_f_gpu (the m=0 SOTA primitive, already acc routine seq), flux difference + J source into dq_gpu. The Maxwell-flux variant is selected ONCE at host side, then a specialized device kernel runs with no per-cell variant branch. Inter-realm seam accumulation (issue #23 R3): after the face sweeps, at the realm's FINAL RK substage only (α.r1, CPU parity), the seam face skins are device-packed, D2H-copied (tiny slabs) and accumulated into the HOST-side flux register — see accumulate_seam_fluxes_fv_dev.
Race discipline (CLAUDE-gpu): the kernels below are MODULE-LEVEL procedures (not contained here) with constant-bound private gathers — the certified #22 F2/F3 pattern.
fortran
subroutine compute_residuals_fv_centered_dev(self, q_gpu, dq_gpu, s, flux_register)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
q_gpu | real(kind=R8P) | inout | Conservative variables. | |
dq_gpu | real(kind=R8P) | inout | Residuals. | |
s | integer(kind=I4P) | in | optional | Stage counter (gates the seam-flux accumulation). |
flux_register | class(flux_register_object) | inout | optional | Forest's flux register for FV seam reflux. |
Call graph
fv_cell_fluxes_maxwell_dev_kernel
Pointwise plain dimensional Maxwell fluxes at every cell (incl. ghosts).
fortran
subroutine fv_cell_fluxes_maxwell_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, chi, q_gpu, flxyz_c_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
ngc | integer(kind=I4P) | in | ||
nv_c | integer(kind=I4P) | in | ||
blocks_number | integer(kind=I4P) | in | ||
chi | real(kind=R8P) | in | ||
q_gpu | real(kind=R8P) | in | ||
flxyz_c_gpu | real(kind=R8P) | inout |
Call graph
fv_cell_fluxes_maxwell_adim_dev_kernel
Pointwise plain adimensional Maxwell fluxes at every cell (incl. ghosts).
fortran
subroutine fv_cell_fluxes_maxwell_adim_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, chi, q_gpu, flxyz_c_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
ngc | integer(kind=I4P) | in | ||
nv_c | integer(kind=I4P) | in | ||
blocks_number | integer(kind=I4P) | in | ||
chi | real(kind=R8P) | in | ||
q_gpu | real(kind=R8P) | in | ||
flxyz_c_gpu | real(kind=R8P) | inout |
Call graph
fv_cell_fluxes_maxwell_div_d_dev_kernel
Pointwise dimensional Maxwell fluxes with D hyperbolic cleaning.
fortran
subroutine fv_cell_fluxes_maxwell_div_d_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, chi, q_gpu, flxyz_c_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
ngc | integer(kind=I4P) | in | ||
nv_c | integer(kind=I4P) | in | ||
blocks_number | integer(kind=I4P) | in | ||
chi | real(kind=R8P) | in | ||
q_gpu | real(kind=R8P) | in | ||
flxyz_c_gpu | real(kind=R8P) | inout |
Call graph
fv_cell_fluxes_maxwell_div_b_dev_kernel
Pointwise dimensional Maxwell fluxes with B hyperbolic cleaning.
fortran
subroutine fv_cell_fluxes_maxwell_div_b_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, chi, q_gpu, flxyz_c_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
ngc | integer(kind=I4P) | in | ||
nv_c | integer(kind=I4P) | in | ||
blocks_number | integer(kind=I4P) | in | ||
chi | real(kind=R8P) | in | ||
q_gpu | real(kind=R8P) | in | ||
flxyz_c_gpu | real(kind=R8P) | inout |
Call graph
fv_cell_fluxes_maxwell_div_d_b_dev_kernel
Pointwise dimensional Maxwell fluxes with D/B hyperbolic cleaning.
fortran
subroutine fv_cell_fluxes_maxwell_div_d_b_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, chi, q_gpu, flxyz_c_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
ngc | integer(kind=I4P) | in | ||
nv_c | integer(kind=I4P) | in | ||
blocks_number | integer(kind=I4P) | in | ||
chi | real(kind=R8P) | in | ||
q_gpu | real(kind=R8P) | in | ||
flxyz_c_gpu | real(kind=R8P) | inout |
Call graph
fv_cell_fluxes_maxwell_adim_div_d_dev_kernel
Pointwise adimensional Maxwell fluxes with D hyperbolic cleaning.
fortran
subroutine fv_cell_fluxes_maxwell_adim_div_d_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, chi, q_gpu, flxyz_c_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
ngc | integer(kind=I4P) | in | ||
nv_c | integer(kind=I4P) | in | ||
blocks_number | integer(kind=I4P) | in | ||
chi | real(kind=R8P) | in | ||
q_gpu | real(kind=R8P) | in | ||
flxyz_c_gpu | real(kind=R8P) | inout |
Call graph
fv_cell_fluxes_maxwell_adim_div_b_dev_kernel
Pointwise adimensional Maxwell fluxes with B hyperbolic cleaning.
fortran
subroutine fv_cell_fluxes_maxwell_adim_div_b_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, chi, q_gpu, flxyz_c_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
ngc | integer(kind=I4P) | in | ||
nv_c | integer(kind=I4P) | in | ||
blocks_number | integer(kind=I4P) | in | ||
chi | real(kind=R8P) | in | ||
q_gpu | real(kind=R8P) | in | ||
flxyz_c_gpu | real(kind=R8P) | inout |
Call graph
fv_cell_fluxes_maxwell_adim_div_d_b_dev_kernel
Pointwise adimensional Maxwell fluxes with D/B hyperbolic cleaning.
fortran
subroutine fv_cell_fluxes_maxwell_adim_div_d_b_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, chi, q_gpu, flxyz_c_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
ngc | integer(kind=I4P) | in | ||
nv_c | integer(kind=I4P) | in | ||
blocks_number | integer(kind=I4P) | in | ||
chi | real(kind=R8P) | in | ||
q_gpu | real(kind=R8P) | in | ||
flxyz_c_gpu | real(kind=R8P) | inout |
Call graph
fv_recon_x_dev_kernel
Reconstruct x-fluxes at x-faces from cell-center fluxes (issue #23 R2): per face i+1/2 (i = 0..ni), gather the 2*s1 cell-flux stencil into a constant-bound private buffer and call the m=0 SOTA face-reconstruction primitive (already acc routine seq).
fortran
subroutine fv_recon_x_dev_kernel(s1, ni, nj, nk, ngc, nv_c, blocks_number, flxyz_c_gpu, flx_f_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
s1 | integer(kind=I4P) | in | Half FDV stencil length. | |
ni | integer(kind=I4P) | in | Grids dimensions. | |
nj | integer(kind=I4P) | in | Grids dimensions. | |
nk | integer(kind=I4P) | in | Grids dimensions. | |
ngc | integer(kind=I4P) | in | Grids dimensions. | |
nv_c | integer(kind=I4P) | in | Conservative variables number. | |
blocks_number | integer(kind=I4P) | in | Grids dimensions. | |
flxyz_c_gpu | real(kind=R8P) | in | Cell-center fluxes (b,1,d,i,j,k,v). | |
flx_f_gpu | real(kind=R8P) | inout | X-face fluxes (b,0:ni,j,k,v). |
Call graph
fv_recon_y_dev_kernel
Reconstruct y-fluxes at y-faces (issue #23 R2); twin of fv_recon_x_dev_kernel.
fortran
subroutine fv_recon_y_dev_kernel(s1, ni, nj, nk, ngc, nv_c, blocks_number, flxyz_c_gpu, fly_f_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
s1 | integer(kind=I4P) | in | Half FDV stencil length. | |
ni | integer(kind=I4P) | in | Grids dimensions. | |
nj | integer(kind=I4P) | in | Grids dimensions. | |
nk | integer(kind=I4P) | in | Grids dimensions. | |
ngc | integer(kind=I4P) | in | Grids dimensions. | |
nv_c | integer(kind=I4P) | in | Conservative variables number. | |
blocks_number | integer(kind=I4P) | in | Grids dimensions. | |
flxyz_c_gpu | real(kind=R8P) | in | Cell-center fluxes (b,1,d,i,j,k,v). | |
fly_f_gpu | real(kind=R8P) | inout | Y-face fluxes (b,i,0:nj,k,v). |
Call graph
fv_recon_z_dev_kernel
Reconstruct z-fluxes at z-faces (issue #23 R2); twin of fv_recon_x_dev_kernel.
fortran
subroutine fv_recon_z_dev_kernel(s1, ni, nj, nk, ngc, nv_c, blocks_number, flxyz_c_gpu, flz_f_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
s1 | integer(kind=I4P) | in | Half FDV stencil length. | |
ni | integer(kind=I4P) | in | Grids dimensions. | |
nj | integer(kind=I4P) | in | Grids dimensions. | |
nk | integer(kind=I4P) | in | Grids dimensions. | |
ngc | integer(kind=I4P) | in | Grids dimensions. | |
nv_c | integer(kind=I4P) | in | Conservative variables number. | |
blocks_number | integer(kind=I4P) | in | Grids dimensions. | |
flxyz_c_gpu | real(kind=R8P) | in | Cell-center fluxes (b,1,d,i,j,k,v). | |
flz_f_gpu | real(kind=R8P) | inout | Z-face fluxes (b,i,j,0:nk,v). |
Call graph
fv_flux_diff_plain_dev_kernel
Conservative flux difference + J source, no hyperbolic damping fields.
fortran
subroutine fv_flux_diff_plain_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, var_jx, var_jy, var_jz, dxyz_gpu, flx_f_gpu, fly_f_gpu, flz_f_gpu, q_gpu, dq_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
ngc | integer(kind=I4P) | in | ||
nv_c | integer(kind=I4P) | in | ||
blocks_number | integer(kind=I4P) | in | ||
var_jx | integer(kind=I4P) | in | ||
var_jy | integer(kind=I4P) | in | ||
var_jz | integer(kind=I4P) | in | ||
dxyz_gpu | real(kind=R8P) | in | ||
flx_f_gpu | real(kind=R8P) | in | ||
fly_f_gpu | real(kind=R8P) | in | ||
flz_f_gpu | real(kind=R8P) | in | ||
q_gpu | real(kind=R8P) | in | ||
dq_gpu | real(kind=R8P) | inout |
Call graph
fv_flux_diff_phi_dev_kernel
Conservative flux difference + J source + phi damping.
fortran
subroutine fv_flux_diff_phi_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, var_jx, var_jy, var_jz, chi_wave, alpha, fv_ivar_phi, rho_ivar, use_rho, dxyz_gpu, flx_f_gpu, fly_f_gpu, flz_f_gpu, q_gpu, dq_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
ngc | integer(kind=I4P) | in | ||
nv_c | integer(kind=I4P) | in | ||
blocks_number | integer(kind=I4P) | in | ||
var_jx | integer(kind=I4P) | in | ||
var_jy | integer(kind=I4P) | in | ||
var_jz | integer(kind=I4P) | in | ||
chi_wave | real(kind=R8P) | in | ||
alpha | real(kind=R8P) | in | ||
fv_ivar_phi | integer(kind=I4P) | in | ||
rho_ivar | integer(kind=I4P) | in | ||
use_rho | integer(kind=I4P) | in | ||
dxyz_gpu | real(kind=R8P) | in | ||
flx_f_gpu | real(kind=R8P) | in | ||
fly_f_gpu | real(kind=R8P) | in | ||
flz_f_gpu | real(kind=R8P) | in | ||
q_gpu | real(kind=R8P) | in | ||
dq_gpu | real(kind=R8P) | inout |
Call graph
fv_flux_diff_psi_dev_kernel
Conservative flux difference + J source + psi damping.
fortran
subroutine fv_flux_diff_psi_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, var_jx, var_jy, var_jz, alpha, fv_ivar_psi, dxyz_gpu, flx_f_gpu, fly_f_gpu, flz_f_gpu, q_gpu, dq_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
ngc | integer(kind=I4P) | in | ||
nv_c | integer(kind=I4P) | in | ||
blocks_number | integer(kind=I4P) | in | ||
var_jx | integer(kind=I4P) | in | ||
var_jy | integer(kind=I4P) | in | ||
var_jz | integer(kind=I4P) | in | ||
alpha | real(kind=R8P) | in | ||
fv_ivar_psi | integer(kind=I4P) | in | ||
dxyz_gpu | real(kind=R8P) | in | ||
flx_f_gpu | real(kind=R8P) | in | ||
fly_f_gpu | real(kind=R8P) | in | ||
flz_f_gpu | real(kind=R8P) | in | ||
q_gpu | real(kind=R8P) | in | ||
dq_gpu | real(kind=R8P) | inout |
Call graph
fv_flux_diff_phi_psi_dev_kernel
Conservative flux difference + J source + phi/psi damping.
fortran
subroutine fv_flux_diff_phi_psi_dev_kernel(ni, nj, nk, ngc, nv_c, blocks_number, var_jx, var_jy, var_jz, chi_wave, alpha, fv_ivar_phi, fv_ivar_psi, rho_ivar, use_rho, dxyz_gpu, flx_f_gpu, fly_f_gpu, flz_f_gpu, q_gpu, dq_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
ngc | integer(kind=I4P) | in | ||
nv_c | integer(kind=I4P) | in | ||
blocks_number | integer(kind=I4P) | in | ||
var_jx | integer(kind=I4P) | in | ||
var_jy | integer(kind=I4P) | in | ||
var_jz | integer(kind=I4P) | in | ||
chi_wave | real(kind=R8P) | in | ||
alpha | real(kind=R8P) | in | ||
fv_ivar_phi | integer(kind=I4P) | in | ||
fv_ivar_psi | integer(kind=I4P) | in | ||
rho_ivar | integer(kind=I4P) | in | ||
use_rho | integer(kind=I4P) | in | ||
dxyz_gpu | real(kind=R8P) | in | ||
flx_f_gpu | real(kind=R8P) | in | ||
fly_f_gpu | real(kind=R8P) | in | ||
flz_f_gpu | real(kind=R8P) | in | ||
q_gpu | real(kind=R8P) | in | ||
dq_gpu | real(kind=R8P) | inout |
Call graph
accumulate_seam_fluxes_fv_dev
Accumulate the FV seam face fluxes of one RK stage, weighted by its SSP coefficient weight = beta_s, into the forest's flux register — FNL twin of prism_cpu_object%accumulate_seam_fluxes_fv (issue #23 R3).
Register crossing (grilled R0 default): the flux register stays HOST-side. Per seam (block, fec) hit, a tiny device kernel packs the face skin into a contiguous device slab (inner axis fastest — the register's cell order), ONE D2H copy (~nv*nface_cells doubles, tens of KB per step) brings it to the host, and the shared register machinery does the rest: coarse side → accumulate_coarse_flux directly; fine side → quadrant offset from maps%amr_seam_quadrant (Morton-code precompute, issue #28 D2) + the pure 2:1 restriction restrict_fine_face_to_quadrant (moved to adam_flux_register_object, shared with the CPU backend) → accumulate_fine_flux. Fires at every RK stage, scaled by weight. Third-axis register index hardcoded to 1 (α.r1 collapsed register), exactly as on CPU.
fortran
subroutine accumulate_seam_fluxes_fv_dev(self, weight, flux_register)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The realm. | |
weight | real(kind=R8P) | in | Stage weight, the SSP coefficient beta_s. | |
flux_register | class(flux_register_object) | inout | Forest's flux register. |
Call graph
fv_pack_face_skin_dev_kernel
Pack one block's face flux skin into a contiguous device slab (issue #23 R3): skin_gpu(c, v) with c = (outer-1)*inner_n + inner — the register cell order, identical to the CPU pack (pack_coarse_face / fine_face_cell mappings). Scalar element reads/writes only: no private arrays, no section actuals. The fec branch is uniform per launch (firstprivate scalar). Tiny kernel: one launch per seam (block, fec) hit, once per step.
fortran
subroutine fv_pack_face_skin_dev_kernel(fec, ni, nj, nk, nv_c, b, inner_n, outer_n, flx_f_gpu, fly_f_gpu, flz_f_gpu, skin_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
fec | integer(kind=I4P) | in | Face code 1..6 (-x,+x,-y,+y,-z,+z). | |
ni | integer(kind=I4P) | in | Interior cell counts. | |
nj | integer(kind=I4P) | in | Interior cell counts. | |
nk | integer(kind=I4P) | in | Interior cell counts. | |
nv_c | integer(kind=I4P) | in | Conservative variables number. | |
b | integer(kind=I4P) | in | Block index. | |
inner_n | integer(kind=I4P) | in | Tangential cell counts (inner fastest). | |
outer_n | integer(kind=I4P) | in | Tangential cell counts (inner fastest). | |
flx_f_gpu | real(kind=R8P) | in | X-face fluxes. | |
fly_f_gpu | real(kind=R8P) | in | Y-face fluxes. | |
flz_f_gpu | real(kind=R8P) | in | Z-face fluxes. | |
skin_gpu | real(kind=R8P) | inout | Packed skin (inner_n*outer_n, nv_c). |
Call graph
fv_apply_reflux_face_dev_kernel
Apply the Berger-Colella end-of-step correction for ONE register face to the committed q_gpu (issue #23 R4): per skin cell c (register cell order — the SAME (axis, sgn) → (i,j,k) mapping as the CPU apply), add scale * delta(v, c) to every state row. Scalar element ops only: no private arrays, no section actuals; each c writes a distinct cell (disjoint), the inner v loop is per-thread seq. Tiny kernel — one launch per face per step.
fortran
subroutine fv_apply_reflux_face_dev_kernel(axis, sgn, b, ni, nj, nk, ngc, nv_reg, nface_cells, scale, delta_gpu, q_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
axis | integer(kind=I4P) | in | Face normal axis (1..3) and sign (+-1). | |
sgn | integer(kind=I4P) | in | Face normal axis (1..3) and sign (+-1). | |
b | integer(kind=I4P) | in | Coarse block index. | |
ni | integer(kind=I4P) | in | Grids dimensions. | |
nj | integer(kind=I4P) | in | Grids dimensions. | |
nk | integer(kind=I4P) | in | Grids dimensions. | |
ngc | integer(kind=I4P) | in | Grids dimensions. | |
nv_reg | integer(kind=I4P) | in | Register state-vector width. | |
nface_cells | integer(kind=I4P) | in | Skin cell count. | |
scale | real(kind=R8P) | in | sign * dt / dx_coarse. | |
delta_gpu | real(kind=R8P) | in | Flux mismatch slab (nv_reg, nface_cells). | |
q_gpu | real(kind=R8P) | inout | Committed conservative variables. |
Call graph
integrate_rk_ssp_pic
Integrate PIC equations with SSP RK on device: the field on SELAH's Butcher form (#132), the stage state the stepper's device register (the stage current is deposited into it, as into the former stage buffer).
fortran
subroutine integrate_rk_ssp_pic(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
gather_pic_fields_dev
Gather E and B at the particles into pic_fnl%pic_fields_gpu: the coherent gathers of totorica and esirkepov_Q<N> run in conserving_fnl (P^T on the virtual block, then the base shape), every other model is the pic_fnl gather. The neighbour list of q_pic_gpu must be current.
fortran
subroutine gather_pic_fields_dev(self, q_gpu, q_pic_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
q_gpu | real(kind=R8P) | in | Fields on device. | |
q_pic_gpu | real(kind=R8P) | in | Particles on device. |
Call graph
fold_deposited_ghosts_dev
Fold the PIC deposits that spilled into ghost cells back onto the cells they mirror, on this rank and across ranks, then refill the ghosts. CPU twin: prism_common_object%fold_deposited_ghosts. With one rank this is reduce_ghost_local_gpu alone. Collective: called even by a rank without particles (its deposits are zero).
fortran
subroutine fold_deposited_ghosts_dev(self, q_gpu, v_first, v_last)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
q_gpu | real(kind=R8P) | inout | Field variables on device. | |
v_first | integer(kind=I4P) | in | First variable to fold. | |
v_last | integer(kind=I4P) | in | Last variable to fold. |
Call graph
migrate_particles
Hand the particles that left the blocks of this rank to their new owners (end of a time step), then align the local particle counts of the device helpers. No-op with one rank.
fortran
subroutine migrate_particles(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
sync_particle_number
Copy the number of particles owned by this rank (host pic, after injection/distribution, restart or migration) into the device helpers, whose kernels loop on it. The particle arrays keep the capacity of the rank (issue #112).
fortran
subroutine sync_particle_number(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
integrate_rk_ssp_pic_charge_conserving
Integrate PIC equations with SSP RK and charge-conserving current reconstruction on device. CPU twin: prism_cpu_object%integrate_rk_ssp_pic_charge_conserving (same call sequence). The stage field is the RK stage buffer itself (the CPU copies it into q_stage, which is only read until assign_stage overwrites the buffer).
fortran
subroutine integrate_rk_ssp_pic_charge_conserving(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
initialize_pic_conserving_current_time_zero
Deposit rho (esirkepov_Q<N>) and the conserving current at t=0 on device, then return them to the host q. CPU twins: deposit_pic_modified_charge + initialize_pic_conserving_current_time_zero, called at the same point of set_initial_conditions (before the host-side elliptic solves that read rho and J).
fortran
subroutine initialize_pic_conserving_current_time_zero(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
pic_begin_step
Open the step of the particles' companion (#134 D5).
fortran
subroutine pic_begin_step(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
pic_begin_stage
Open stage k of the particles' companion: SELAH builds the particles' stage state, up (device).
fortran
subroutine pic_begin_stage(self, k, up)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
k | integer(kind=I4P) | in | Stage. | |
up | real(kind=R8P) | out | pointer | Particles' stage state. |
Call graph
pic_residual
The particles' residual at their stage state, into the companion's register (device): x' = v, v' = (q/m) (E + v x B), the fields gathered at the stage positions (pic_fields_gpu, D scaled to E); charge and mass constant.
fortran
subroutine pic_residual(self, up)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
up | real(kind=R8P) | in | pointer | Particles' 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
k | integer(kind=I4P) | in | Stage. |
Call graph
pic_finish_step
Close the step of the particles' companion: SELAH advances the particles (device).
fortran
subroutine pic_finish_step(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
k | integer(kind=I4P) | in | Stage. |
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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
k | integer(kind=I4P) | in | Stage. |
Call graph
pml_finish_step
Close the step of every PML face companion: SELAH advances the device face arrays.
fortran
subroutine pml_finish_step(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
integrate_rk_ls_dev
Integrate equation, time operator, RK classical low storage schemes on the device: SELAH's two-register form (#132), every stage on q_gpu; the residual of each stage into dq_gpu (the residual log is stage 1's), copied into the stepper's residual register.
fortran
subroutine integrate_rk_ls_dev(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
integrate_rk_ssp_dev
Integrate equation, time operator, SSP RK schemes on the device: SELAH's Butcher form (#132), each stage state on the stepper's device register, its residual into dq_gpu, copied into the stepper's residual register (dq_gpu keeps the last stage's residual, as before: the step residual is not asked); the PML auxiliary fields advance in step on their own storage with the same tableau.
fortran
subroutine integrate_rk_ssp_dev(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
ts_begin_step
Open the stepper's step on q_gpu; the solid cells are masked with immersed solids.
fortran
subroutine ts_begin_step(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
s | integer(kind=I4P) | in | Stage. |
Call graph
ts_end_stage
Close stage s of the stepper (the two-register forms advance q_gpu here); masked with immersed solids.
fortran
subroutine ts_end_stage(self, s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
s | integer(kind=I4P) | in | Stage. |
Call graph
ts_finish_step
Close the stepper's step: the Butcher form advances q_gpu (no step residual: dq_gpu keeps the last stage's residual, as the former device update_q left it).
fortran
subroutine ts_finish_step(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
is_done_forest
Decide whether this realm has reached its local termination criterion.
Invoked by forest%is_done. PRISM-FNL override: matches the legacy condition inline in simulate — terminate when either the simulated time has reached self%time%time_max (time-driven mode, it_max <= 0) or the iteration count has reached self%time%it_max (iteration-driven mode). Today the test reads time-state from the time module singleton, so self is unused; once the forest takes over time bookkeeping the body will consume self%time%* instead.
fortran
subroutine is_done_forest(self, done)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The realm. | |
done | logical | out | True if this realm is done evolving. |
Call graph
finalize_forest
Shut this realm down: final state dump, close residuals file, finalize MPI handler.
fortran
subroutine finalize_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The realm. |
Call graph
initialize_process_context
Initialize the process context once (the forest calls it before any realm, #80 P3): the FNL handler (device binding, ranks sharing the device) first, since it may also be the MPI init, then the CPU handler.
fortran
subroutine initialize_process_context(self, verbose)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation (carries no MPI state). | |
verbose | logical | in | optional | Trigger verbose output. |
Call graph
finalize_mpi_forest
Finalize the process-global FNL MPI handler (mpih_fnl).
Overrides realm_object%finalize_mpi_forest to target the FNL mpih_fnl singleton instead of the CPU mpih. Called ONCE by forest%finalize after every realm's finalize_forest (see the base for the rationale).
fortran
subroutine finalize_mpi_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The realm (carries no MPI state). |
Call graph
simulate
Perform the simulation: legacy single-realm entry point.
fortran
subroutine simulate(self, filename)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
filename | character(len=*) | in | Input file name. |
Call graph
initialize_app_forest
Template hook: the PRISM backend (common data, dispatch, backend data).
fortran
subroutine initialize_app_forest(self, filename, realms_number)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The realm. | |
filename | character(len=*) | in | Input parameters file name. | |
realms_number | integer(kind=I4P) | in | optional | Realm 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The realm. |
Call graph
compute_local_dt_forest
Compute this realm's local stability-limited dt (no MPI reduction).
Invoked by forest%compute_global_dt during the min reduction across all realms in the forest. The reduction itself is the orchestrator's job; this method computes only the value local to self. Compute this realm's local stability-limited dt (no MPI reduction).
fortran
subroutine compute_local_dt_forest(self, dt_local)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The realm. | |
dt_local | real(kind=R8P) | out | Local 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The realm. | |
dt | real(kind=R8P) | in | Timestep size from the forest's global reduction. |
Call graph
open_step_forest
Per-step prologue on the multi-realm path: set dt, init RK stages.
Mirrors the head of integrate_rk_ssp: external-field prelude (if active), rk%initialize_stages(q=self%q), and the per-step time bookkeeping advance_one_step_forest does inline (it increment, dt cap for time_max, self%time%dt update). Time advance and progress print run in close_step_forest, mirroring the legacy ordering.
fortran
subroutine open_step_forest(self, dt)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The realm. | |
dt | real(kind=R8P) | in | Timestep size from the forest. |
Call graph
begin_stage_forest
Begin integrator stage k on the multi-realm path (FNL).
Mirrors the FIRST line of integrate_rk_ssp's substage body: ts_begin_stage(self, s=k): SELAH builds the device stage state of k from the previous stages and self%q_gpu, and this publishes the stage buffer to peers by setting self%stage_active = k. No ghost reads, no peer-realm access — peer realms may not yet have opened their stage-k buffer when this fires.
fortran
subroutine begin_stage_forest(self, k, K_total, dt, realm)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The realm. | |
k | integer(kind=I4P) | in | Stage index (1..K_total). | |
K_total | integer(kind=I4P) | in | Forest-wide stage count for this step. | |
dt | real(kind=R8P) | in | Timestep size from the forest. | |
realm | type(realm_pointer) | inout | target, optional | Sibling realms (contract parity). |
Call graph
seam_ghosts_to_state
Copy the ghosts of q_gpu of the end_of_step seams into the stepper's stage state (#132 rule 1, #116): the stage reads the peer state of the last exchange (the device twin of adam_seam_exchange%seam_ghosts_to_state).
fortran
subroutine seam_ghosts_to_state(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The realm. |
Call graph
end_stage_forest
Close integrator stage k: residuals + stage assignment in one sweep (FNL).
This is the FNL forest's Phase 3 TBP. Inter-realm seam ghost cells on the stage state of k are already filled by Phase 2 (which called fill_seam_from_peer_forest on this realm and its peers), so compute_residuals_dev reads valid halo data and the stage's residual write no longer races with peer reads.
realm accepted on contract for parity but unused: the seam has already been refreshed by the forest. FV seam-flux ACCUMULATION is threaded through flux_register (issue #23 R3, CPU parity); the reflux APPLICATION (apply_reflux_to_stage_forest) remains a no-op until #23 R4.
fortran
subroutine end_stage_forest(self, k, K_total, dt, realm, flux_register)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The realm. | |
k | integer(kind=I4P) | in | Stage index (1..K_total). | |
K_total | integer(kind=I4P) | in | Forest-wide stage count for this step. | |
dt | real(kind=R8P) | in | Timestep size from the forest. | |
realm | type(realm_pointer) | inout | target, optional | Sibling realms (FNL parity only; unused). |
flux_register | class(flux_register_object) | inout | optional | Forest's flux register for FV reflux. |
Call graph
close_step_forest
Per-step epilogue on the multi-realm path: q assembly, BC, div-clean, residual save, coil source refresh, time advance, progress print (FNL).
fortran
subroutine close_step_forest(self, dt)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The realm. | |
dt | real(kind=R8P) | in | Timestep size from the forest. |
Call graph
fill_seam_from_peer_forest
FNL twin of prism_cpu_object%fill_seam_from_peer_forest. Walks the host-side row-range bookkeeping (seam_local_peer_row_start/count, populated by build_seam_local_map on the host), then dispatches an OpenACC kernel that reads peer's GPU buffer at peer-INTERIOR coords (FNL layout (b,i,j,k,v)) and writes self's GPU buffer at recv-side coords.
fortran
subroutine fill_seam_from_peer_forest(self, peer, p_idx)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | ||
peer | class(realm_object) | in | target | |
p_idx | integer(kind=I4P) | in |
Call graph
pack_seam_cells_forest
Pack the ghost values of the seam send rows of peer slot p_idx from the active device buffer (q_gpu when stage_active == 0, else the active stage state) into the host buf, nv values per row: cell copies, or the 2:1 interpolations and restrictions of a refined seam (issues #40, #52).
fortran
subroutine pack_seam_cells_forest(self, p_idx, buf)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The realm. | |
p_idx | integer(kind=I4P) | in | Peer slot (the realm owning the ghosts). | |
buf | real(kind=R8P) | out | Packed values. |
Call graph
unpack_seam_cells_forest
Unpack the host buf into this realm's seam ghosts of the cross-rank receive rows of peer slot p_idx, on the active device buffer, nv values per row (issue #40).
fortran
subroutine unpack_seam_cells_forest(self, p_idx, buf)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The realm. | |
p_idx | integer(kind=I4P) | in | Peer slot (the realm owning the cells). | |
buf | real(kind=R8P) | in | Packed values. |
Call graph
after_topology_build_forest
Propagate the freshly-built host seam maps and per-peer buffers to device-resident counterparts on field_fnl%maps. Invoked by the forest at the end of populate_inter_realm_topology AFTER build_seam_local_map has populated self%adam%maps%seam_local_*.
fortran
subroutine after_topology_build_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout |
Call graph
apply_reflux_to_stage_forest
PRISM-FNL override of the Berger-Colella reflux correction TBP — the apply twin of prism_cpu_object%apply_reflux_to_stage_forest (issue #23 R4, M4 semantics).
α.r1 cadence: end-of-step barrier. Fires exactly once per realm per step at stage == self%ts%stages(); earlier substages return immediately. For each register face whose coarse side this realm — and this RANK (#28 D4) — owns, the correction sign*(dt/dx_coarse)*(F_coarse − F_fine_sum)(:,:,1) is applied to the COMMITTED q_gpu on the one-cell-thick coarse seam skin (this TBP runs AFTER close_step_forest's update_q). Full step weight dt/dx — NOT a stage RK coefficient, and NOT a q_rk_gpu(...,stage) write (both were the pre-M4 sketch's errors: ark is never allocated for the SSP family, and a stage-buffer write would entangle the stage beta weight — see the CPU apply's M4 note). The tiny host mismatch slab is H2D-copied per face and fv_apply_reflux_face_dev_kernel adds it to q_gpu (scalar ops only, disjoint cells).
fortran
subroutine apply_reflux_to_stage_forest(self, stage, dt, flux_register)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The realm. | |
stage | integer(kind=I4P) | in | Integrator stage 1..K_total. | |
dt | real(kind=R8P) | in | Time step. | |
flux_register | class(flux_register_object) | in | Forest's flux register. |
Call graph
post_step_forest
Run PRISM-FNL's per-timestep post-step work: state IO, energy diagnostics, max-divergence diagnostics.
Invoked by forest%post_step. v1 implementation is the verbatim post- step block formerly inline in simulate — every action runs every step, since today's cadence is enforced inside the save_* routines themselves (e.g. save_simulation_data honours io%it_save). The do_* flags are signature-only for now: when the forest takes over cadence the flags will gate the individual calls. For now they are accepted but unused, preserving present-day behavior bit-for-bit.
dt, t, it are not consumed by the current body; they are on the contract so the forest can supply them once it owns time-state (today they are still read from the time module singleton).
Optional realm(:): forwarded to save_simulation_data and update_ghost for the dummy-argument inter-realm halo refresh path.
fortran
subroutine post_step_forest(self, dt, t, it, do_save_state, do_save_residuals, do_save_restart, do_amr, realm)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The realm. | |
dt | real(kind=R8P) | in | Timestep size just advanced. | |
t | real(kind=R8P) | in | Simulation time after the advance. | |
it | integer(kind=I4P) | in | Iteration index after the advance. | |
do_save_state | logical | in | optional | Save state output this step. |
do_save_residuals | logical | in | optional | Save residuals output this step. |
do_save_restart | logical | in | optional | Save restart dump this step. |
do_amr | logical | in | optional | Run AMR update this step. |
realm | type(realm_pointer) | inout | target, optional | Sibling realms for inter-realm halo refresh. |
Call graph
compute_plasma_frequencies
Maxima of the plasma frequencies over the cells and the particles (collective): they limit the next PIC step. particles (Omega_c, transit: q_pic, pic_fields and the particle-cell map aligned, before the end-of-step wrap and migration) and cells (omega_p and the composite frequencies: the map of the final positions), both by default (issue #129, R7).
fortran
subroutine compute_plasma_frequencies(self, particles, cells)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. | |
particles | logical | in | optional | Particle terms (default true). |
cells | logical | in | optional | Cell term (default true). |
Call graph
locate_particles_end_of_step
The particle-cell map of the final positions, after the end-of-step wrap and migration (issue #129, R7): the omega_p limit of the next step reads it, and the restart rebuilds the same. Only when they moved or reordered the particles: more than one rank or a periodic face.
fortran
subroutine locate_particles_end_of_step(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
compute_dt
Compute the global stability-limited dt and store it on self%time%dt.
Body delegates the local computation to compute_local_dt_forest (orchestrator contract method), then performs the legacy MPI_ALLREDUCE on MPI_COMM_WORLD for backward compatibility with simulate. The forest's compute_global_dt performs its own reduction, possibly on a per-realm sub-comm; the redundancy disappears once the legacy compute_dt is retired.
fortran
subroutine compute_dt(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
initialize_charge_conservation_diagnostic
Initialize rho_n/dt + sum_s beta_s div(J_s) diagnostic accumulator.
fortran
subroutine initialize_charge_conservation_diagnostic(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
accumulate_charge_conservation_current
Accumulate beta_s div(J_s) for the current PIC RK stage.
fortran
subroutine accumulate_charge_conservation_current(self, q_gpu, weight, s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | ||
q_gpu | real(kind=R8P) | inout | ||
weight | real(kind=R8P) | in | ||
s | integer(kind=I4P) | in |
Call graph
finalize_charge_conservation_diagnostic
Finalize max |(rho_np1-rho_n)/dt + sum_s beta_s div(J_s)|.
fortran
subroutine finalize_charge_conservation_diagnostic(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout |
Call graph
save_charge_conservation_diagnostic
Save the 12-column PIC charge-conservation diagnostic for the current completed step.
fortran
subroutine save_charge_conservation_diagnostic(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout |
Call graph
compute_energy
Compute energy.
fortran
subroutine compute_energy(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
compute_energy_error
Compute energy error.
fortran
subroutine compute_energy_error(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout |
Call graph
sample_probes
Sample the fields at the probes on the device; only the local sums reach the host.
fortran
subroutine sample_probes(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
sync_probes
Copy the probe stencils, just built on the host, to the device.
fortran
subroutine sync_probes(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
compute_magnetic_field_at_center_domain
Compute the magnetic field interpolated at the geometrical domain center.
fortran
subroutine compute_magnetic_field_at_center_domain(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout |
Call graph
compute_max_divergence_outside_absorbing_layers
Host divergence maxima excluding ghost cells, absorbing layers and any cell whose centered-divergence stencil intersects them, from the host divergence array. CPU twin of the same name (prism_cpu_object); the device counterpart used during the run is compute_max_divergence.
fortran
subroutine compute_max_divergence_outside_absorbing_layers(self, hs, max_div_D, max_div_B, max_div_J)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The equation. | |
hs | integer(kind=I4P) | in | Half stencil of the divergence operator. | |
max_div_D | real(kind=R8P) | out | Max |div(D)| (|div(D)-rho| for PIC). | |
max_div_B | real(kind=R8P) | out | Max |div(B)|. | |
max_div_J | real(kind=R8P) | out | Max |div(J)|. |
Call graph
compute_max_divergence
Compute maximum divergence.
fortran
subroutine compute_max_divergence(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | inout | The equation. |
Call graph
Functions
has_tv_marker
True if an AMR marker is the coil total variation (AMR_TV, mark_by_j_vec_total_variation), the only user of j_vec_tv_gpu.
Attributes: pure
Returns: logical
fortran
function has_tv_marker(amr) result(has)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
amr | type(amr_object) | in | AMR markers. |
Call graph
pic_box
The particles' companion box: the active particles, every component (q_pic_gpu(capacity, 8)).
Returns: type(box)
fortran
function pic_box(self) result(bx)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The equation. |
Call graph
stages_per_step_forest
Number of integrator stages this realm exposes per step (FNL).
SSP-only contract, twin of prism_cpu_object%stages_per_step_forest (issue #25): the staged protocol reads gamm(k) per stage and beta_gpu in close_step_forest — for low-storage schemes those are never allocated (the FNL symptom was CUDA_ERROR_ILLEGAL_ADDRESS in rk_update_q_dev through a bogus beta_gpu). Refusing here leaves the fused fast path — where LS schemes legitimately run — untouched.
Returns: integer(kind=I4P)
fortran
function stages_per_step_forest(self) result(K)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_fnl_object) | in | The realm. |
Call graph