Appearance
adam_prism_cpu_object
ADAM, PRISM (Plasma Research usIng Simulation Methods) equations system class definition, CPU backend.
Source: src/app/prism/cpu/adam_prism_cpu_object.F90
Dependencies
Contents
- prism_cpu_object
- compute_residuals_interface
- integrate_interface
- mark_by_j_vec_total_variation
- allocate_cpu
- initialize_prism
- save_residuals
- save_simulation_data
- compute_coils_current
- apply_fWL_correction
- set_boundary_conditions
- compute_face_mirror_indexes
- enforce_silver_muller_normal_bc_cpu
- solve_silver_muller_normal_line_cpu
- silver_muller_face_metadata_cpu
- solve_silver_muller_normal_field_cpu
- interior_cell_from_face_cpu
- ghost_cell_from_face_cpu
- set_initial_conditions
- update_ghost
- 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
- end_stage_forest
- close_step_forest
- fill_seam_from_peer_forest
- pack_seam_cells_forest
- unpack_seam_cells_forest
- apply_reflux_to_stage_forest
- post_step_forest
- is_done_forest
- finalize_forest
- compute_dt
- compute_plasma_frequencies
- compute_energy
- compute_energy_error
- compute_grms
- compute_magnetic_field_at_center_domain
- compute_max_divergence_outside_absorbing_layers
- exclude_stencil_contaminated_face
- simulate
- compute_residuals_fd_centered
- apply_pml_fd_centered_ade
- apply_direct_damping
- select_pml_field_scales
- apply_x_face_field_correction
- apply_y_face_field_correction
- apply_z_face_field_correction
- compute_x_face_pml_rhs
- compute_y_face_pml_rhs
- compute_z_face_pml_rhs
- compute_pml_coefficients
- compute_residuals_fv_centered
- accumulate_seam_fluxes_fv
- compute_residuals_weno
- 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
- integrate_rk_ssp
- integrate_rk_ssp_pic
- integrate_rk_ssp_pic_charge_conserving
- compute_pic_esirkepov_displacement
- compute_esirkepov_gaussian_shape_1d
- esirkepov_shape_weight_1d
- initialize_charge_conservation_diagnostic
- accumulate_charge_conservation_current
- finalize_charge_conservation_diagnostic
- save_charge_conservation_diagnostic
- solve_pic_charge_conserving_current_dispatch
- ensure_londrillo_current_solver_cache
- solve_pic_charge_conserving_current_londrillo
- modified_kernels
- filter_modified_axis
- filter_matched_box_axis
- filter_matched_passes
- matched_shape_1d
- check_matched_support
- fold_matched_cell
- deposit_matched_current
- store_matched_current
- deposit_matched_charge_box
- deposit_pic_modified_charge
- initialize_pic_conserving_current_time_zero
- check_conserving_single_block
- modified_current_line
- solve_pic_charge_conserving_current_modified
- solve_modified_current_with_cleanup
- cleanup_modified_particle_current
- report_particle_tail_error
- build_esirkepov_face_line
- update_esirkepov_face_residual
- find_pic_position_cell
- particle_weighting_radius
- particle_shape_weight_1d
- build_centered_reconstruction_matrix
- factorize_matrix_pivot
- solve_factored_matrix_pivot
- odd_mirror_index
- impose_zero_current_ghosts
- impose_odd_current_ghosts
- integrate_rk_yoshida
- ts_begin_step
- ts_begin_stage
- ts_end_stage
- ts_finish_step
- copy_stage_state
- compute_dxyz_min
- compute_fluxes_convective_weno
- compute_fluxes_convective_weno_s1
- compute_fluxes_convective_weno_s2
- compute_fluxes_convective_weno_s3
- compute_fluxes_convective_weno_s4
- compute_fluxes_convective_weno_s5
- compute_fluxes_difference
- compute_field_mean_value
- is_face_line_seed_cpu
- face_normal_direction_cpu
- silver_muller_unknown_coefficient_cpu
- tangential_divergence_at_cell_cpu
- normal_known_contribution_cpu
- normal_depth_from_cell_cpu
- component_along_direction_cpu
- stages_per_step_forest
- compute_pml_kappa
- pic_box
- modified_filter_radius
- modified_position_shift
- dotproduct
- crossproduct
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
compute_fluxes_maxwell | procedure(compute_convective_fluxes_interface) | pointer | Compute convective fluxes. |
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 | |
GRMS_3DB_RATIO | real(kind=R8P) | parameter |
Derived Types
prism_cpu_object
Maxwell equations system class definition, CPU 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. | |
flxyz_c | real(kind=R8P) | allocatable | Fluxes at cell center with +/- decomposition for all directions. |
flx_f | real(kind=R8P) | allocatable | Fluxes along x at cell face. |
fly_f | real(kind=R8P) | allocatable | Fluxes along y at cell face. |
flz_f | real(kind=R8P) | allocatable | Fluxes along z at cell face. |
charge_conservation_acc | real(kind=R8P) | allocatable | Accumulator for rho/dt + weighted div(J) diagnostic. |
charge_conservation_divj | real(kind=R8P) | allocatable | Workspace for stage div(J) diagnostic. |
londrillo_current_matrix_x | real(kind=R8P) | allocatable | Cached factored x-line matrices for the londrillo PIC current. |
londrillo_current_matrix_y | real(kind=R8P) | allocatable | Cached factored y-line matrices for the londrillo PIC current. |
londrillo_current_matrix_z | real(kind=R8P) | allocatable | Cached factored z-line matrices for the londrillo PIC current. |
londrillo_current_pivot_x | integer(kind=I4P) | allocatable | Cached x-line pivots for the londrillo PIC current. |
londrillo_current_pivot_y | integer(kind=I4P) | allocatable | Cached y-line pivots for the londrillo PIC current. |
londrillo_current_pivot_z | integer(kind=I4P) | allocatable | Cached z-line pivots for the londrillo PIC current. |
londrillo_current_cache_ni | integer(kind=I4P) | Cached x-line size. | |
londrillo_current_cache_nj | integer(kind=I4P) | Cached y-line size. | |
londrillo_current_cache_nk | integer(kind=I4P) | Cached z-line size. | |
londrillo_current_cache_nb | integer(kind=I4P) | Cached block count. | |
londrillo_current_cache_hs | integer(kind=I4P) | Cached half-stencil. | |
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. | |
charge_conservation_error_max | real(kind=R8P) | Max continuity-equation residual over one PIC step. | |
current_solver_residual_max | real(kind=R8P) | Max residual of the direct current line solves. | |
charge_conservation_ready | logical | True when the current PIC step has a finalized diagnostic. | |
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. Pointer (abstract) TBP. | |
compute_residuals | procedure(compute_residuals_interface) | pass(self), pointer | Compute residuals, space operator. |
integrate | procedure(integrate_interface) | pass(self), pointer | Integrate, time operator. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
load_fdv_from_file | pass(self) | Load FDV config from file. |
initialize_process_context | pass(self) | Process-global MPI (+ device) init; forest calls it ONCE first. |
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). |
finalize_mpi_forest | pass(self) | Process-global MPI finalize; forest calls it ONCE after all. |
after_topology_build_forest | pass(self) | Backend hook invoked once after the forest builds the seam maps. |
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 | pass(self) | Do AMR update (init-time only where amr_locked_). |
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. |
rebalance | pass(self) | Balance the static grid's blocks by count (issue #123). |
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. |
load_restart_files | pass(self) | Load restart files. |
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. |
sample_probes | pass(self) | Sample the fields at the probes (backend override). |
sync_probes | pass(self) | Sync the probe stencils with the backend (backend override). |
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. |
mark_by_j_vec_total_variation | pass(self) | Mark blocks to be refined/derefined by the value of total variation of j_vec. |
allocate_cpu | pass(self) | Allocate CPU data. |
initialize_prism | pass(self) | Initialize PRSIM equation. |
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. |
set_boundary_conditions | pass(self) | Set boundary conditions of equation. |
set_initial_conditions | pass(self) | Set initial conditions (and coils) of equation. |
update_ghost | pass(self) | Update ghost cells and set boundary conditions. |
compute_field_mean_value | pass(self) | Compute field mean value. |
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. |
fill_seam_from_peer_forest | pass(self) | Copy peer's interior into self's ghosts for peer slot p_idx. |
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. |
apply_reflux_to_stage_forest | pass(self) | Apply end-of-step Berger-Colella reflux to self's committed q. |
initialize_charge_conservation_diagnostic | pass(self) | Initialize PIC continuity-equation diagnostic. |
accumulate_charge_conservation_current | pass(self) | Accumulate weighted stage div(J). |
finalize_charge_conservation_diagnostic | pass(self) | Finalize PIC continuity-equation diagnostic. |
save_charge_conservation_diagnostic | pass(self) | Save PIC charge-conservation diagnostic history. |
compute_dt | pass(self) | Compute time step. |
compute_plasma_frequencies | pass(self) | Plasma frequencies limiting the next PIC step. |
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. |
simulate | pass(self) | Perform the simulation. |
prism_cpu_object%load_fdv_from_file
Load FDV config from file.
fortran
subroutine load_fdv_from_file(self, file_parameters)Arguments
| 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_cpu_object%initialize_process_context
Initialize the process-global MPI handler (and the device, on the device backends).
MPI and the device context are process-global: the forest calls this ONCE, on a single realm, before any realm is initialized (issue #80 P3, the mirror of finalize_mpi_forest); a realm never initializes them itself. The default initializes the CPU mpih singleton; the FNL backends override it to initialize mpih_fnl (device binding, the ranks sharing a device) first. mpih%initialize is once-only, so a test driver that called it already is harmless.
fortran
subroutine initialize_process_context(self, verbose)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm (carries no MPI state; dispatch picks the backend). | |
verbose | logical | in | optional | Trigger verbose output. |
Call graph
prism_cpu_object%initialize_forest
Initialize this realm, the library template (issue #80 P3): the sequence every application shares, its steps delegated to the *_forest hooks below.
fortran
call self%initialize_app_forest(filename, realms_number) ! parse, build the library and app objects, the backend
if (self%io%restart) then
call self%restart_state_forest ! the state from the restart files
else
do i=1, self%initial_amr_iterations_forest() ! the initial state, then a regrid on it, n times
call self%set_initial_state_forest
call self%amr_update_initial_forest
enddo
call self%rebalance_initial_forest ! [amr].(balance_static)
call self%set_initial_state_forest ! the initial state on the final grid
call self%adam%make_comm_local_maps_ghost_bc ! the maps of the final grid
call self%reset_time_forest
endif
call self%post_initial_state_forest ! device push, ghosts, t0 diagnostics, history 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_cpu_object%runtime_amr_forest
Return whether this realm regrids during the time loop (issue #74, runtime AMR).
The forest asks it before every regrid: with a realm that regrids, a multi-realm forest fills its seams before the realms mark and balances their marks across the seams (issue #110). Default: no runtime regridding, the behaviour of every app before #74; an app that regrids overrides it.
Returns: logical
fortran
function runtime_amr_forest(self) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The realm. |
Call graph
prism_cpu_object%regrid_forest
Regrid this realm if its cadence asks for it now (issue #74, runtime AMR).
Invoked by forest%regrid once per realm after post_step_forest, on committed q (no stage active). The realm marks its blocks, calls adam%amr_update and refreshes its grid-dependent state; regridded tells the forest whether the tree changed, so it rebuilds what it owns (the flux register). Default: never regrid.
fortran
subroutine regrid_forest(self, regridded)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm. | |
regridded | logical | out | True if the tree changed. |
Call graph
prism_cpu_object%regrid_begin_forest
Start a multi-realm regrid of this realm: active if its cadence asks for a regrid now (issue #110).
fortran
subroutine regrid_begin_forest(self, active)Arguments
| 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_cpu_object%regrid_mark_forest
Mark the blocks of this realm for sweep sweep and gather the marks on its replicated tree (issue #110).
marked is false when the realm does not mark in this sweep (no regrid step, or more sweeps than its [amr] iters); the forest then clears its tree marks before balancing the seams.
fortran
subroutine regrid_mark_forest(self, sweep, marked)Arguments
| 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_cpu_object%regrid_apply_forest
Adapt this realm to the marks on its replicated tree, as the forest balanced them (issue #110).
fortran
subroutine regrid_apply_forest(self, changed)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm. | |
changed | logical | out | The tree changed. |
Call graph
prism_cpu_object%regrid_end_forest
End a multi-realm regrid of this realm: refresh the state of the new grid, regridded if any sweep changed it.
fortran
subroutine regrid_end_forest(self, regridded)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm. | |
regridded | logical | out | The tree changed in some sweep. |
Call graph
prism_cpu_object%finalize_mpi_forest
Finalize the process-global MPI handler.
MPI_FINALIZE is process-global and must run EXACTLY ONCE, after every realm has completed all MPI-using teardown. The forest therefore calls this on a SINGLE realm after the per-realm finalize_forest loop — not inside finalize_forest (which runs per realm; doing the finalize there tore MPI down while later realms still had IO/ghost work pending — the next realm's update_ghost would hit MPI_Type_f2c on a finalized communicator). The default targets the CPU mpih singleton; the FNL backend overrides to finalize mpih_fnl.
fortran
subroutine finalize_mpi_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm (carries no MPI state; dispatch picks the backend handler). |
Call graph
prism_cpu_object%after_topology_build_forest
Backend hook invoked by forest%populate_inter_realm_topology AFTER all host-side seam maps have been built. CPU default is a no-op (host maps are the production state). GPU backends override to propagate the freshly-built host seam maps to device-resident copies (e.g. via maps_fnl%copy_cpu_gpu).
fortran
subroutine after_topology_build_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout |
Call graph
prism_cpu_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_cpu_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_cpu_object%open_block_xh5f
Open XH5F file block; length_scale multiplies the written block origin and spacing (output units of an application, e.g. FLUME [reference] output_units). The origin is the corner of the first stored cell: ngc_saved cells below the block's first interior cell, ngc_saved the ghost layers the caller writes (default all, ngc; 0 for the interior only, e.g. the restart snapshot, issue #109).
fortran
subroutine open_block_xh5f(self, xh5f, b, nijk, t, time, length_scale, ngc_saved)Arguments
| 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_cpu_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_cpu_object%save_q_xh5f
Save ADAM in XH5F format.
fortran
subroutine save_q_xh5f(self, basename, q, q_name, directory, with_ghost, with_cell_morton, t, time)Arguments
| 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_cpu_object%compute_curl_fd_extended
Compute curl of vector fields, div(q(ivar:ivar+2), using finite difference schemes.
fortran
subroutine compute_curl_fd_extended(self, hs, ivar, q, curl)Arguments
| 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_cpu_object%compute_gradient_fd_extended
Compute gradient of scalar variable q(ivar), finite difference schemes.
fortran
subroutine compute_gradient_fd_extended(self, hs, ivar, q, gradient)Arguments
| 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_cpu_object%amr_update
Do AMR update.
fortran
subroutine amr_update(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_cpu_object%amr_update_initial_forest
One initial regrid on the host (the FNL override of amr_update follows it with the device PML twins).
fortran
subroutine amr_update_initial_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_cpu_object%initial_amr_iterations_forest
The passes of initial conditions + regrid before the final initial conditions, ic%amr_iterations.
Returns: integer(kind=I4P)
fortran
function initial_amr_iterations_forest(self) result(n)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | in | The equation. |
Call graph
prism_cpu_object%rebalance_initial_forest
PRISM regrids at initialization only: balance the blocks by count, sibling sets split (issue #123).
fortran
subroutine rebalance_initial_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_cpu_object%reset_time_forest
The time and the step counter of a run from scratch to zero (dt is kept: the conserving PIC t0 path set it).
fortran
subroutine reset_time_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_cpu_object%rebalance
Balance the blocks over the ranks by count, complete sibling sets split (issue #123), after the initial AMR. PRISM regrids at initialization only (amr_locked_), so its grid is never derefined afterwards. The per-block data are rebuilt as amr_update rebuilds them after a grid change; the caller imposes the initial conditions (and the device copies) after it.
fortran
subroutine rebalance(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_cpu_object%mark_by_geometry
Mark blocks to be refined by a primitive axis-aligned box (deterministic, solution-independent).
A block is flagged TO_BE_REFINED iff its centroid lies inside [box_emin, box_emax] AND its current refinement level is below target_level. This is the AMR_GEO + AMR_GEO_PRIMITIVE_BOX marker: it produces a deterministic 2:1 coarse-fine jump at known coordinates, decoupled from the IB/solid geometry, for the issue #13 intra-realm AMR seam test fixture (#13 §7.5, M0).
fortran
subroutine mark_by_geometry(self, box_emin, box_emax, target_level, do_init)Arguments
| 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_cpu_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_cpu_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_cpu_object%compute_fields_number
Compute the block-sized fields PRISM allocates per block, the fields_number of the blocks budget.
Both backends allocate the same nb-sized arrays, on the host (CPU) or on the device (FNL), so one count serves both: q, dq, curl, divergence (4 nv), the time integrator's registers (SELAH's, stepper_stored_fields nv: the stage states and residuals, the residual register included, #132), the coils current density (3 per coil), the two PIC charge-continuity accumulators (only with a charge-conservation history), and the flux arrays of the scheme in use: the cell fluxes flxyz_c (9 nv) for FV and WENO, the face fluxes (3 nv, counted as full block fields) for FV only, none for centered FD (issue #112). Backend-only arrays are added by the backend estimate of initialize; face-local PML storage is not block-sized and is not counted. The FNL estimate also takes curl and divergence off the count: there they are host arrays only, recomputed from q at the saves (issue #112 C). Requires physics and numerics initialized and [runge_kutta] parsed into rk; loads the coils number (it needs no grid or field).
fortran
subroutine compute_fields_number(self, file_parameters, fields_number)Arguments
| 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_cpu_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_cpu_object%initialize_block_face_data
(Re)build the per-block face data on the current grid: the PEC faces of the external fields, the fWLayer ranges and the PML support with its RK storage. All are indexed by local block, so they must follow every change of the block set: the uniform refinement in initialize, each init-time amr_update, a restart (issue #95, P5.1). Every initializer called here resets its object first; the PML auxiliary state restarts from zero, as at any initialization.
fortran
subroutine initialize_block_face_data(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_cpu_object%fold_deposited_ghosts
Fold the PIC deposits that spilled into ghost cells back onto the cells they mirror, on this rank and across ranks, then refill the ghosts: the result equals a single-block deposit of the same particles. With one rank this is reduce_ghost_local alone. Collective.
fortran
subroutine fold_deposited_ghosts(self, q, v_first, v_last)Arguments
| 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_cpu_object%initialize_pic_time_zero
Initialize PIC particles and deposit host-side charge/current sources at t=0.
fortran
subroutine initialize_pic_time_zero(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_cpu_object%register_pic_deposition_on_coils
Right after a PIC deposit into q: plasma current or charge on the coil support is no longer an error. The current is kept (committed or stage slot) and summed with the coil current by every later coil stamp of that state; the first occurrence is warned and repeated at the end of the run (report_plasma_on_coils). Collective (with coils): the overlap is reduced over the ranks and, when found, the ghosts of q are refreshed before the support (ghost cells included) is kept, so a ghost copy of a support cell carries its plasma current too. Without overlap q is untouched.
fortran
subroutine register_pic_deposition_on_coils(self, q, stage, check_current, check_charge, context)Arguments
| 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_cpu_object%report_plasma_on_coils
End of the run: repeat the warning of plasma deposited on coil cells, with the first iteration (and its call site) and the last one over all the ranks. Collective.
fortran
subroutine report_plasma_on_coils(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | in | The equation. |
Call graph
prism_cpu_object%weight_pic_fields_time_zero
Interpolate initialized fields at particle positions at t=0.
fortran
subroutine weight_pic_fields_time_zero(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_cpu_object%save_pic_self_force_diagnostic_time_zero
Temporary diagnostic for single-particle PIC self-force analysis.
fortran
subroutine save_pic_self_force_diagnostic_time_zero(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | in |
Call graph
prism_cpu_object%load_restart_files
Save restart files.
fortran
subroutine load_restart_files(self, t, time)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. | |
t | integer(kind=I4P) | out | Time iteration. | |
time | real(kind=R8P) | out | Time. |
Call graph
prism_cpu_object%save_energy_error
Save energy error history.
fortran
subroutine save_energy_error(self, is_to_open, is_to_close)Arguments
| 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_cpu_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_cpu_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_cpu_object%save_divergence_history
Save divergence history.
fortran
subroutine save_divergence_history(self, is_to_open, is_to_close, div_D, div_B, div_J, current_solver_residual)Arguments
| 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_cpu_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_cpu_object%save_magnetic_field_at_center_domain_history
Save domain-center magnetic-field history.
fortran
subroutine save_magnetic_field_at_center_domain_history(self, is_to_open, is_to_close)Arguments
| 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_cpu_object%save_probes_history
Save the field probes history on its cadence ([probes] save_every and the last step); collective.
With is_to_open the stencils are built on the current grid, synced with the backend and the files opened. The probes sample q as stored: the external fields, if any, are not added.
fortran
subroutine save_probes_history(self, is_to_open)Arguments
| 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_cpu_object%sample_probes
Sample the fields at the probes: local sums of the host q (CPU); a device backend overrides it.
fortran
subroutine sample_probes(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_cpu_object%sync_probes
Sync the probe stencils with the backend after they are built: nothing on the host; a device backend overrides it.
fortran
subroutine sync_probes(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_cpu_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_cpu_object%save_slices
Save the slices (library slices_object, [slices] / [slice_N]) on their cadence, one file per field set: <basename>-slice_NN-<it>.mat holds q (the total field when external fields are applied, as the XH5F output), <basename>-curl-slice_NN-<it>.mat and <basename>-div-slice_NN-<it>.mat the curl and divergence fields when their XH5F output is enabled ([IO] save_curl_fields, save_divergence_fields). The caller has refreshed the ghost cells of the host q and computed the auxiliary fields. These are computed on the interior cells only, so their intra-realm ghost cells are refreshed here: the stencil of a point in the half cell next to a block face reads them. Their physical-boundary ghost cells are not set: a point in the half cell next to the domain boundary interpolates with them.
fortran
subroutine save_slices(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_cpu_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_cpu_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_cpu_object%compute_coils_current_time_zero
Compute coils current sources on the host at time t=0.
fortran
subroutine compute_coils_current_time_zero(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. |
Call graph
prism_cpu_object%impose_pic_fields_time_zero
Compute initial condition for the fields in presence of plasma or current sources.
The electric field (PIC): D(G) phi = -rho/eps, then D <- D - eps G phi. The magnetic field: D(G) A_d = -mu J_d per component, then B <- B + curl A. D(G) is PRISM's own operator, the order-p centred derivative composed with itself (fdv_order), so the corrected field satisfies div D = rho to round-off with PRISM's divergence (issue #84, E3a). The solves run by FLAIL's FFT solver (E3b); an exact/open face holds the free-space potential of the source in its ghosts, summed over the whole domain (E3c). A refined grid is refused: the wide operator across 2:1 faces is not defined yet (E7).
The correction is written in the interior cells only: the caller refreshes the ghosts of the corrected field (exchange and boundary conditions, refresh_time_zero_ghosts of each backend), as every stage does before reading them. The former extension of the gradient/curl into the first ngc/2 ghost layers read the potential ngc/2 + hs layers deep, which tied ngc to 2 hs (issue #112, the ghost cells of FD6) for values every stage overwrites.
fortran
subroutine impose_pic_fields_time_zero(self, ivar)Arguments
| 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_cpu_object%has_current_density
Return true if the current density (host q) is non-zero on any rank; every rank must call it. It decides whether the elliptic magnetic-field initialization runs. A rank-local test let the ranks holding current enter that solve while the others skipped it, and the solve's ghost exchange then waited forever (issue #84).
Returns: logical
fortran
function has_current_density(self) result(has)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | in | The equation. |
Call graph
prism_cpu_object%set_rectangular_coil_x
Set rectangular coil with normal direction parallel to x.
fortran
subroutine set_rectangular_coil_x(self, n, verse)Arguments
| 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_cpu_object%set_rectangular_coil_y
Set rectangular coil with normal direction parallel to y.
fortran
subroutine set_rectangular_coil_y(self, n, verse)Arguments
| 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_cpu_object%set_rectangular_coil_z
Set rectangular coil with normal direction parallel to z.
fortran
subroutine set_rectangular_coil_z(self, n, verse)Arguments
| 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_cpu_object%set_circular_coil_x
Set circular coil with normal direction parallel to x.
fortran
subroutine set_circular_coil_x(self, n, verse)Arguments
| 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_cpu_object%set_circular_coil_y
Set circular coil with normal direction parallel to y.
fortran
subroutine set_circular_coil_y(self, n, verse)Arguments
| 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_cpu_object%set_circular_coil_z
Set circular coil with normal direction parallel to z.
fortran
subroutine set_circular_coil_z(self, n, verse)Arguments
| 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_cpu_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_cpu_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_cpu_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_cpu_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_cpu_object%compute_rectangular_current_flux_sides
Numerically measure the current crossing each local side-normal section of a rectangular coil.
fortran
subroutine compute_rectangular_current_flux_sides(self, coil_id, i_dir_n, i_dir_a, i_dir_b, a1, a2, b1, b2, verse)Arguments
| 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_cpu_object%compute_helicon_current_flux_segments
Numerically measure the current crossing each local segment-normal section.
fortran
subroutine compute_helicon_current_flux_segments(self, coil_id)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_common_object) | inout | The equation. | |
coil_id | integer(kind=I4P) | in | Coil index. |
Call graph
prism_cpu_object%coupling_descriptor_forest
Report this realm's coupling descriptor for β admissibility.
Returns (numerics%scheme_time, rk%scheme, physics%nv). β admits a seam between two realms iff all three values agree. Spatial operator (numerics%scheme_space) is intentionally NOT in the descriptor — β exists precisely to support different spatial operators per realm.
Provided on prism_common_object so both prism_cpu_object and prism_fnl_object inherit a single implementation.
fortran
subroutine coupling_descriptor_forest(self, scheme_time, rk_scheme, nv)Arguments
| 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
Interfaces
compute_residuals_interface
integrate_interface
Subroutines
mark_by_j_vec_total_variation
Mark blocks to be refined/derefined by the value of total variation of j_vec.
fortran
subroutine mark_by_j_vec_total_variation(self, tv_tol, delta_type, delta_fine, delta_coarse, threshold, do_init)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_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
allocate_cpu
Allocate CPU data.
fortran
subroutine allocate_cpu(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
initialize_prism
Initialize PRSIM equation.
fortran
subroutine initialize_prism(self, filename, realms_number)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. | |
filename | character(len=*) | in | Input file name. | |
realms_number | integer(kind=I4P) | in | optional | Forest realm count; divides the per-process budget (default 1). |
Call graph
save_residuals
Save residuals history.
fortran
subroutine save_residuals(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_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_cpu_object) | inout | The equation. |
Call graph
compute_coils_current
Compute current coils sources (DC/AC with smooth envelope).
fortran
subroutine compute_coils_current(self, q, gamma)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | ||
q | real(kind=R8P) | inout | ||
gamma | real(kind=R8P) | in | optional |
Call graph
apply_fWL_correction
Apply correction if a fWL is present
fortran
subroutine apply_fWL_correction(self, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. | |
q | real(kind=R8P) | inout | Conservative variables. |
Call graph
set_boundary_conditions
Set boundary conditions of equation.
fortran
subroutine set_boundary_conditions(self, q, s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. | |
q | real(kind=R8P) | inout | Conservative variables. | |
s | integer(kind=I4P) | in | optional | Stage counter. |
Call graph
compute_face_mirror_indexes
Return the donor indexes mirrored across the selected boundary face.
fortran
subroutine compute_face_mirror_indexes(face, ni, nj, nk, i_gc, j_gc, k_gc, idelta, jdelta, kdelta, i_d, j_d, k_d)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
face | integer(kind=I4P) | in | Face index in 1:6 numbering. | |
ni | integer(kind=I4P) | in | Grid dimensions. | |
nj | integer(kind=I4P) | in | Grid dimensions. | |
nk | integer(kind=I4P) | in | Grid dimensions. | |
i_gc | integer(kind=I4P) | in | Ghost-cell indexes. | |
j_gc | integer(kind=I4P) | in | Ghost-cell indexes. | |
k_gc | integer(kind=I4P) | in | Ghost-cell indexes. | |
idelta | integer(kind=I4P) | in | One-step inward deltas. | |
jdelta | integer(kind=I4P) | in | One-step inward deltas. | |
kdelta | integer(kind=I4P) | in | One-step inward deltas. | |
i_d | integer(kind=I4P) | out | Mirrored donor indexes. | |
j_d | integer(kind=I4P) | out | Mirrored donor indexes. | |
k_d | integer(kind=I4P) | out | Mirrored donor indexes. |
Call graph
enforce_silver_muller_normal_bc_cpu
fortran
subroutine enforce_silver_muller_normal_bc_cpu(self, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
q | real(kind=R8P) | inout |
Call graph
solve_silver_muller_normal_line_cpu
fortran
subroutine solve_silver_muller_normal_line_cpu(q, ngc, ni, nj, nk, b, face, i_seed, j_seed, k_seed, hs, dxyz, has_rho, var_rho)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
q | real(kind=R8P) | inout | ||
ngc | integer(kind=I4P) | in | ||
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
b | integer(kind=I4P) | in | ||
face | integer(kind=I4P) | in | ||
i_seed | integer(kind=I4P) | in | ||
j_seed | integer(kind=I4P) | in | ||
k_seed | integer(kind=I4P) | in | ||
hs | integer(kind=I4P) | in | ||
dxyz | real(kind=R8P) | in | ||
has_rho | logical | in | ||
var_rho | integer(kind=I4P) | in |
Call graph
silver_muller_face_metadata_cpu
fortran
subroutine silver_muller_face_metadata_cpu(face, dir_t1, dir_t2, var_d_t1, var_d_t2, var_d_n, var_b_t1, var_b_t2, var_b_n)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
face | integer(kind=I4P) | in | ||
dir_t1 | integer(kind=I4P) | out | ||
dir_t2 | integer(kind=I4P) | out | ||
var_d_t1 | integer(kind=I4P) | out | ||
var_d_t2 | integer(kind=I4P) | out | ||
var_d_n | integer(kind=I4P) | out | ||
var_b_t1 | integer(kind=I4P) | out | ||
var_b_t2 | integer(kind=I4P) | out | ||
var_b_n | integer(kind=I4P) | out |
Call graph
solve_silver_muller_normal_field_cpu
fortran
subroutine solve_silver_muller_normal_field_cpu(q, ngc, ni, nj, nk, b, face, i_seed, j_seed, k_seed, hs, dxyz, dir_t1, dir_t2, var_t1, var_t2, var_n, use_target_var, target_var)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
q | real(kind=R8P) | inout | ||
ngc | integer(kind=I4P) | in | ||
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
b | integer(kind=I4P) | in | ||
face | integer(kind=I4P) | in | ||
i_seed | integer(kind=I4P) | in | ||
j_seed | integer(kind=I4P) | in | ||
k_seed | integer(kind=I4P) | in | ||
hs | integer(kind=I4P) | in | ||
dxyz | real(kind=R8P) | in | ||
dir_t1 | integer(kind=I4P) | in | ||
dir_t2 | integer(kind=I4P) | in | ||
var_t1 | integer(kind=I4P) | in | ||
var_t2 | integer(kind=I4P) | in | ||
var_n | integer(kind=I4P) | in | ||
use_target_var | logical | in | ||
target_var | integer(kind=I4P) | in |
Call graph
interior_cell_from_face_cpu
fortran
subroutine interior_cell_from_face_cpu(face, eq, ni, nj, nk, i_seed, j_seed, k_seed, ic, jc, kc)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
face | integer(kind=I4P) | in | ||
eq | integer(kind=I4P) | in | ||
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
i_seed | integer(kind=I4P) | in | ||
j_seed | integer(kind=I4P) | in | ||
k_seed | integer(kind=I4P) | in | ||
ic | integer(kind=I4P) | out | ||
jc | integer(kind=I4P) | out | ||
kc | integer(kind=I4P) | out |
Call graph
ghost_cell_from_face_cpu
fortran
subroutine ghost_cell_from_face_cpu(face, ghost_layer, ni, nj, nk, i_seed, j_seed, k_seed, ic, jc, kc)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
face | integer(kind=I4P) | in | ||
ghost_layer | integer(kind=I4P) | in | ||
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
i_seed | integer(kind=I4P) | in | ||
j_seed | integer(kind=I4P) | in | ||
k_seed | integer(kind=I4P) | in | ||
ic | integer(kind=I4P) | out | ||
jc | integer(kind=I4P) | out | ||
kc | integer(kind=I4P) | out |
Call graph
set_initial_conditions
Set initial conditions and coils on field.
fortran
subroutine set_initial_conditions(self, is_restart)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_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). If not specified all steps are performed, synchronous computation.
Inter-realm seam ghost cells are NO LONGER filled here: the forest's Phase 2 seam fill (between begin_stage and end_stage) populates them via the fill_seam_from_peer_forest TBP operating on the realm's currently-active buffer (selected internally via stage_active). The realm(:) optional dummy that used to thread through this signature has been retired.
fortran
subroutine update_ghost(self, q, step, s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. | |
q | real(kind=R8P) | inout | Conservative variables. | |
step | integer(kind=I4P) | in | optional | Step to be perfordmed in asyncronous comp. |
s | integer(kind=I4P) | in | optional | Stage counter. |
Call graph
initialize_app_forest
Template hook: the PRISM backend (common data, dispatch, backend data).
fortran
subroutine initialize_app_forest(self, filename, realms_number)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_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_cpu_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_cpu_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_cpu_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.
fortran
subroutine compute_local_dt_forest(self, dt_local)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_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_cpu_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, open the stepper's step.
Mirrors the head of integrate_rk_ssp: ts_begin_step and the PML companions' pml_begin_step, and the per-step time bookkeeping advance_one_step_forest does inline (it increment, dt cap for time_max, self%time%dt update). Time advance and progress print run in close_step_forest, mirroring the legacy ordering.
fortran
subroutine open_step_forest(self, dt)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_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.
Mirrors the FIRST line of integrate_rk_ssp's substage body: ts_begin_stage(self, s=k). SELAH builds the stage state of k from the previous stages and self%q, and this publishes the stage buffer to peers by setting self%stage_active = k. No ghost reads, no peer-realm access — peer realms may not yet have opened their stage-k buffer when this fires.
fortran
subroutine begin_stage_forest(self, k, K_total, dt, realm)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_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
end_stage_forest
Close integrator stage k: residuals + stage assignment in one sweep.
fortran
subroutine end_stage_forest(self, k, K_total, dt, realm, flux_register)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_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). |
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.
Mirrors the post-substage tail of integrate_rk_ssp: ts%finish_step + save_residuals + compute_coils_current + external_fields add, plus the post-loop time advance + progress print that advance_one_step_forest does inline.
fortran
subroutine close_step_forest(self, dt)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The realm. | |
dt | real(kind=R8P) | in | Timestep size from the forest. |
Call graph
fill_seam_from_peer_forest
Fill THIS realm's seam ghost cells for peer slot p_idx from peer's interior cells. Single-TBP roundtrip: walks the receiver's sorted seam-map slice for the peer, and for each row copies peer's INTERIOR(b_send, i_send, j_send, k_send, v) → self's GHOST (b_recv, i_recv, j_recv, k_recv, v) on the active conservative buffer (q when stage_active == 0, or the stepper's stage state when active). The PEER's stage_active controls its read source; SELF's stage_active controls its write target.
select type(peer) is confined here — the only place that needs to know the peer's concrete backend type. Cross-backend mixing (CPU realm reading from FNL peer) is not supported and triggers error_stop.
fortran
subroutine fill_seam_from_peer_forest(self, peer, p_idx)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_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 cross-rank seam send rows of peer slot p_idx from the active buffer (q when stage_active == 0, else the active stage state): cell copies, or the 2:1 interpolations and restrictions of a refined seam (issues #40, #52; adam_seam_exchange%pack_seam_rows).
fortran
subroutine pack_seam_cells_forest(self, p_idx, buf)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_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 buf into this realm's seam ghosts of the cross-rank receive rows of peer slot p_idx, on the active buffer (issue #40; adam_seam_exchange%unpack_seam_rows).
fortran
subroutine unpack_seam_cells_forest(self, p_idx, buf)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_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
apply_reflux_to_stage_forest
PRISM-CPU override of the Berger-Colella reflux correction TBP.
α.r1 cadence: end-of-step barrier. The body fires exactly once per realm per step, at stage == self%ts%stages() (the realm's own final RK substage). Earlier stages return immediately as a no-op. The accumulators F_coarse(:,:,1) / F_fine_sum(:,:,1) hold the step flux sum_s beta_s F_s of each side (accumulate_seam_fluxes_fv fires at every stage, weighted by beta_s), i.e. the flux each side's committed update used, so the correction restores conservation to round-off; same-K and asymmetric-K realms alike, each side summing its own beta. This is the AMReX non-subcycled Reflux cadence.
For each face in flux_register where face%coarse_realm == self%realm_index, writes the per-cell correction to the committed q (after close_step_forest) q(:, seam_cell, b_coarse) += sign * (dt / dx_coarse) * (F_coarse(:,:,1) - F_fine_sum(:,:,1)) on the matching one-cell-thick seam slice (i ∈ {1, ni} for x-normal faces, etc.). The third-axis index is hardcoded to 1 under α.r1 (register collapsed by M2); the stage parameter is retained on the signature for API stability and used only for the cadence gate.
Empty-register / out-of-range guards short-circuit to a no-op, so a realm with no seam faces returns cleanly.
fortran
subroutine apply_reflux_to_stage_forest(self, stage, dt, flux_register)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_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-CPU's per-timestep post-step work: state IO, energy diagnostics, divergence diagnostics.
Invoked by forest%post_step. v1 implementation is the verbatim post- step block formerly inline in simulate — every action runs every step, since today's cadence is enforced inside the save_* routines themselves (e.g. save_simulation_data honours io%it_save). The do_* flags are signature-only for now: when the forest takes over cadence the flags will gate the individual calls. For now they are accepted but unused, preserving present-day behavior bit-for-bit.
dt, t, it are not consumed by the current body; they are on the contract so the forest can supply them once it owns time-state (today they are still read from the time module singleton).
realm is accepted on contract parity with FNL; unused on CPU.
fortran
subroutine post_step_forest(self, dt, t, it, do_save_state, do_save_residuals, do_save_restart, do_amr, realm)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_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. |
Call graph
is_done_forest
Decide whether this realm has reached its local termination criterion.
Invoked by forest%is_done. PRISM-CPU override: matches the legacy condition inline in simulate — terminate when either the simulated time has reached self%time%time_max (time-driven mode, it_max <= 0) or the iteration count has reached self%time%it_max (iteration-driven mode). Today the test reads time-state from the time module singleton, so self is unused; once the forest takes over time bookkeeping the body will consume self%time%* instead.
fortran
subroutine is_done_forest(self, done)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_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/energy/ divergence history files, post-loop divergence diagnostics, finalize MPI handler.
Invoked by forest%finalize. v1 implementation is the verbatim post- loop block formerly inline in simulate. Behavior unchanged.
fortran
subroutine finalize_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The realm. |
Call graph
compute_dt
Compute the global stability-limited dt and store it on self%time%dt.
Body delegates the local computation to compute_local_dt_forest (orchestrator contract method), then performs the legacy MPI_ALLREDUCE on MPI_COMM_WORLD for backward compatibility with simulate. The forest's compute_global_dt will perform its own reduction, possibly on a per-realm sub-comm; the redundancy disappears once the legacy compute_dt is retired.
fortran
subroutine compute_dt(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
compute_plasma_frequencies
Maxima of the plasma frequencies over the cells and the particles (collective): they limit the next PIC step. particles (Omega_c, transit: q_pic, pic_fields and the particle-cell map aligned, before the end-of-step wrap and migration) and cells (omega_p and the composite frequencies: the map of the final positions), both by default (issue #129, R7).
fortran
subroutine compute_plasma_frequencies(self, particles, cells)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. | |
particles | logical | in | optional | Particle terms (default true). |
cells | logical | in | optional | Cell term (default true). |
Call graph
compute_energy
Compute energy.
fortran
subroutine compute_energy(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_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_cpu_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_cpu_object) | inout |
Call graph
compute_magnetic_field_at_center_domain
Compute the magnetic field interpolated at the geometrical domain center.
fortran
subroutine compute_magnetic_field_at_center_domain(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout |
Call graph
compute_max_divergence_outside_absorbing_layers
Compute divergence maxima excluding absorbing layers and any cell whose centered-divergence stencil intersects them.
fortran
subroutine compute_max_divergence_outside_absorbing_layers(self, hs, max_div_D, max_div_B, max_div_J)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
hs | integer(kind=I4P) | in | ||
max_div_D | real(kind=R8P) | out | ||
max_div_B | real(kind=R8P) | out | ||
max_div_J | real(kind=R8P) | out |
Call graph
exclude_stencil_contaminated_face
Shrink a 1D diagnostic window so that no retained cell uses a centered divergence stencil intersecting the selected absorbing layer face.
Attributes: pure
fortran
subroutine exclude_stencil_contaminated_face(lo, hi, face_first, face_last, is_minus, hs)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lo | integer(kind=I4P) | inout | ||
hi | integer(kind=I4P) | inout | ||
face_first | integer(kind=I4P) | in | ||
face_last | integer(kind=I4P) | in | ||
is_minus | logical | in | ||
hs | integer(kind=I4P) | in |
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_cpu_object) | inout | The equation. | |
filename | character(len=*) | in | Input file name. |
Call graph
compute_residuals_fd_centered
Compute residuals of equation, space operator, centered finite difference schemes.
fortran
subroutine compute_residuals_fd_centered(self, q, dq, s, flux_register)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. | |
q | real(kind=R8P) | inout | Conservative variables. | |
dq | real(kind=R8P) | inout | Residuals. | |
s | integer(kind=I4P) | in | optional | Stage counter. |
flux_register | class(flux_register_object) | inout | optional | Flux register. |
Call graph
apply_pml_fd_centered_ade
Add ADE-PML source terms to the FD-centered Maxwell residuals and build the 12 auxiliary RHSs.
fortran
subroutine apply_pml_fd_centered_ade(self, q, dq, s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | ||
q | real(kind=R8P) | in | ||
dq | real(kind=R8P) | inout | ||
s | integer(kind=I4P) | in | optional |
Call graph
apply_direct_damping
Apply diagnostic direct damping on components transverse to the selected PML normal.
fortran
subroutine apply_direct_damping(self, q, dq, block_ids, face)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
q | real(kind=R8P) | in | ||
dq | real(kind=R8P) | inout | ||
block_ids | integer(kind=I4P) | in | ||
face | integer(kind=I4P) | in |
Call graph
select_pml_field_scales
Convert D/B derivatives into E/H derivatives for the current physical scaling.
fortran
subroutine select_pml_field_scales(self, inv_eps_scale, inv_mu_scale)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
inv_eps_scale | real(kind=R8P) | out | ||
inv_mu_scale | real(kind=R8P) | out |
Call graph
apply_x_face_field_correction
fortran
subroutine apply_x_face_field_correction(self, q, q_face, dq, block_ids, face, inv_eps_scale, inv_mu_scale)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
q | real(kind=R8P) | in | ||
q_face | real(kind=R8P) | in | ||
dq | real(kind=R8P) | inout | ||
block_ids | integer(kind=I4P) | in | ||
face | integer(kind=I4P) | in | ||
inv_eps_scale | real(kind=R8P) | in | ||
inv_mu_scale | real(kind=R8P) | in |
Call graph
apply_y_face_field_correction
fortran
subroutine apply_y_face_field_correction(self, q, q_face, dq, block_ids, face, inv_eps_scale, inv_mu_scale)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
q | real(kind=R8P) | in | ||
q_face | real(kind=R8P) | in | ||
dq | real(kind=R8P) | inout | ||
block_ids | integer(kind=I4P) | in | ||
face | integer(kind=I4P) | in | ||
inv_eps_scale | real(kind=R8P) | in | ||
inv_mu_scale | real(kind=R8P) | in |
Call graph
apply_z_face_field_correction
fortran
subroutine apply_z_face_field_correction(self, q, q_face, dq, block_ids, face, inv_eps_scale, inv_mu_scale)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
q | real(kind=R8P) | in | ||
q_face | real(kind=R8P) | in | ||
dq | real(kind=R8P) | inout | ||
block_ids | integer(kind=I4P) | in | ||
face | integer(kind=I4P) | in | ||
inv_eps_scale | real(kind=R8P) | in | ||
inv_mu_scale | real(kind=R8P) | in |
Call graph
compute_x_face_pml_rhs
fortran
subroutine compute_x_face_pml_rhs(self, q, q_face, dq_face, block_ids, face, inv_eps_scale, inv_mu_scale, exact, lam_face)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
q | real(kind=R8P) | in | ||
q_face | real(kind=R8P) | in | ||
dq_face | real(kind=R8P) | inout | ||
block_ids | integer(kind=I4P) | in | ||
face | integer(kind=I4P) | in | ||
inv_eps_scale | real(kind=R8P) | in | ||
inv_mu_scale | real(kind=R8P) | in | ||
exact | logical | in | Exact decay: the residual is the source alone. | |
lam_face | real(kind=R8P) | inout | Decay rate (written with the exact decay). |
Call graph
compute_y_face_pml_rhs
fortran
subroutine compute_y_face_pml_rhs(self, q, q_face, dq_face, block_ids, face, inv_eps_scale, inv_mu_scale, exact, lam_face)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
q | real(kind=R8P) | in | ||
q_face | real(kind=R8P) | in | ||
dq_face | real(kind=R8P) | inout | ||
block_ids | integer(kind=I4P) | in | ||
face | integer(kind=I4P) | in | ||
inv_eps_scale | real(kind=R8P) | in | ||
inv_mu_scale | real(kind=R8P) | in | ||
exact | logical | in | Exact decay: the residual is the source alone. | |
lam_face | real(kind=R8P) | inout | Decay rate (written with the exact decay). |
Call graph
compute_z_face_pml_rhs
fortran
subroutine compute_z_face_pml_rhs(self, q, q_face, dq_face, block_ids, face, inv_eps_scale, inv_mu_scale, exact, lam_face)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
q | real(kind=R8P) | in | ||
q_face | real(kind=R8P) | in | ||
dq_face | real(kind=R8P) | inout | ||
block_ids | integer(kind=I4P) | in | ||
face | integer(kind=I4P) | in | ||
inv_eps_scale | real(kind=R8P) | in | ||
inv_mu_scale | real(kind=R8P) | in | ||
exact | logical | in | Exact decay: the residual is the source alone. | |
lam_face | real(kind=R8P) | inout | Decay rate (written with the exact decay). |
Call graph
compute_pml_coefficients
Return the face-local ADE-PML coefficients for the supported variants.
Attributes: pure
fortran
subroutine compute_pml_coefficients(self, center_distance, span, gamma, alpha, kappa)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
center_distance | real(kind=R8P) | in | ||
span | real(kind=R8P) | in | ||
gamma | real(kind=R8P) | out | ||
alpha | real(kind=R8P) | out | ||
kappa | real(kind=R8P) | out |
Call graph
compute_residuals_fv_centered
Compute residuals of equation, space operator, centered finite volume schemes.
fortran
subroutine compute_residuals_fv_centered(self, q, dq, s, flux_register)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. | |
q | real(kind=R8P) | inout | Conservative variables. | |
dq | 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; FV reflux. |
Call graph
accumulate_seam_fluxes_fv
Accumulate the face fluxes of one RK stage, weighted by the stage's SSP coefficient weight = beta_s, on the seam faces of the FV-centered scheme.
Walks every (block, fec) pair and, for non-zero entries in self%adam%maps%inter_realm_face_register_index(b, fec), packs the appropriate flx_f/fly_f/flz_f face skin into a (nv, nface_cells) slab and routes it to the right register accumulator: positive index → coarse side → accumulate_coarse_flux, negative index → fine side → accumulate_fine_flux. The call site fires at every stage, so the register sums the stage fluxes into the step flux sum_s beta_s F_s of both sides.
The register accumulators are sized (nv, nface_cells, 1) under α.r1 (M2 reshape) with the full state-vector width nv (set at register_face time from realm%adam%field%nv). The FV scheme only fills the conservative slice 1:nv_c of the flux arrays; the remaining rows are left at zero in flux_slab so the register's F_coarse - F_fine_sum correction is identically zero outside the conservative variables. The third-axis index passed to accumulate_*_flux is hardcoded to 1 (collapsed register).
For a same-resolution mirror seam (rmf-2realm), each coarse and fine side carries an identical end-of-step flux; F_coarse - F_fine_sum is round-off zero in expectation and the downstream q-correction is a no-op. For a true 2:1 intra-realm AMR jump (#13 §7.5 M3) the coarse and fine sides differ:
- Coarse side (
sgn_idx > 0): packs its fullnface_cells-cell face skin directly — the linear indexcruns (inner axis fastest, outer axis slowest) over the coarse cells, exactly as before. - Fine side (
sgn_idx < 0): each of theratio/2(4 in 3D) fine blocks covers ONE quadrant of the coarse face. Itsnj*nkfine-face cells are 2:1-restricted (2x2 conservative average) onto the(nj/2)*(nk/2)coarse cells of that quadrant, written into the coarse-skin-shaped slab at the quadrant offset (zero elsewhere), then accumulated. The quadrant offset is read frommaps%amr_seam_quadrant, precomputed at registration from the two blocks' Morton codes (issue #28 D2 — the coarse partner may live on another rank, so its geometry is not readable here). The fine blocks'accumulate_fine_fluxcalls sum into disjoint quadrants, soF_fine_sumends up holding the area-averaged fine flux over the WHOLE coarse face, matchingF_coarse's shape for the Berger-Colella delta.
Conservative 2:1 averaging (arithmetic mean of the 2x2 fine sub-faces) is the correct restriction for a face FLUX (Berger-Colella 1989 §4; Olivares 2019 Eq. 26-27): the coarse-face flux equals the average of the fine-face fluxes covering it, so the telescoping ∮F·n across the seam cancels to round-off.
The FD-centered case does not reach this routine (different residual target).
fortran
subroutine accumulate_seam_fluxes_fv(self, ni, nj, nk, nv_c, blocks_number, weight, flux_register)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The realm. | |
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 | Number of conservative variables. | |
blocks_number | integer(kind=I4P) | in | Number of local blocks. | |
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
compute_residuals_weno
Compute residuals of equation, space operator, WENO schemes.
fortran
subroutine compute_residuals_weno(self, q, dq, s, flux_register)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. | |
q | real(kind=R8P) | inout | Conservative variables. | |
dq | real(kind=R8P) | inout | Residuals. | |
s | integer(kind=I4P) | in | optional | Stage counter. |
flux_register | class(flux_register_object) | inout | optional | Flux register. |
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_cpu_object) | inout | The equation. |
Call graph
pic_begin_stage
Open stage k of the particles' companion: SELAH builds the particles' stage state, up.
fortran
subroutine pic_begin_stage(self, k, up)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_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: x' = v, v' = (q/m) (E + v x B), the fields gathered at the stage positions (pic_fields, D scaled to E); charge and mass constant.
fortran
subroutine pic_residual(self, up)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_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_cpu_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.
fortran
subroutine pic_finish_step(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_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_cpu_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_cpu_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_cpu_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 face arrays.
fortran
subroutine pml_finish_step(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
integrate_rk_ls
Integrate equation, time operator, RK classical low storage schemes: SELAH's two-register form (#132), every stage on q; the residual of each stage into dq (the residual log is stage 1's), copied into the stepper's register.
fortran
subroutine integrate_rk_ls(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
integrate_rk_ssp
Integrate equation, time operator, SSP RK schemes: SELAH's Butcher form (#132), each stage state on the stepper's register, its residual into dq, copied into the stepper's residual register; the PML auxiliary fields advance in step on their own storage with the same tableau.
fortran
subroutine integrate_rk_ssp(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
integrate_rk_ssp_pic
Integrate equation, time operator, SSP RK schemes. SSP RK on SELAH's Butcher form, the stage states on the stepper's registers.
fortran
subroutine integrate_rk_ssp_pic(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
integrate_rk_ssp_pic_charge_conserving
Integrate PIC equations with SSP RK and charge-conserving current reconstruction.
fortran
subroutine integrate_rk_ssp_pic_charge_conserving(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout |
Call graph
compute_pic_esirkepov_displacement
Symmetric Esirkepov density decomposition for the same separable shape used by rho.
fortran
subroutine compute_pic_esirkepov_displacement(self, q_ref, q_to, h_dir, particle)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
q_ref | real(kind=R8P) | in | ||
q_to | real(kind=R8P) | in | ||
h_dir | real(kind=R8P) | inout | ||
particle | integer(kind=I4P) | in | optional |
Call graph
compute_esirkepov_gaussian_shape_1d
Normalize the filtered Gaussian on the endpoint's own deposition stencil. Its tensor product equals Gaussian_charge_weighting's 3D normalization up to roundoff.
fortran
subroutine compute_esirkepov_gaussian_shape_1d(self, x, x_cell, dx, ip, radius, lo, hi, w)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
x | real(kind=R8P) | in | ||
x_cell | real(kind=R8P) | in | ||
dx | real(kind=R8P) | in | ||
ip | integer(kind=I4P) | in | ||
radius | integer(kind=I4P) | in | ||
lo | integer(kind=I4P) | in | ||
hi | integer(kind=I4P) | in | ||
w | real(kind=R8P) | out |
Call graph
esirkepov_shape_weight_1d
Apply the optional binomial filter to the B-spline before computing particle fluxes.
fortran
subroutine esirkepov_shape_weight_1d(self, x, xc, dx, w)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
x | real(kind=R8P) | in | ||
xc | real(kind=R8P) | in | ||
dx | real(kind=R8P) | in | ||
w | real(kind=R8P) | out |
Call graph
initialize_charge_conservation_diagnostic
Initialize rho_n/dt + sum_s beta_s div(J_s) diagnostic accumulator.
fortran
subroutine initialize_charge_conservation_diagnostic(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout |
Call graph
accumulate_charge_conservation_current
Accumulate beta_s div(J_s) for the current PIC RK stage.
fortran
subroutine accumulate_charge_conservation_current(self, q, weight)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | ||
q | real(kind=R8P) | inout | ||
weight | real(kind=R8P) | in |
Call graph
finalize_charge_conservation_diagnostic
Finalize max |(rho_np1-rho_n)/dt + sum_s beta_s div(J_s)|.
fortran
subroutine finalize_charge_conservation_diagnostic(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout |
Call graph
save_charge_conservation_diagnostic
Save the 12-column PIC charge-conservation diagnostic for the current completed step.
fortran
subroutine save_charge_conservation_diagnostic(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout |
Call graph
solve_pic_charge_conserving_current_dispatch
Select the configured charge-conserving current reconstruction.
fortran
subroutine solve_pic_charge_conserving_current_dispatch(self, q, hq)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | ||
q | real(kind=R8P) | inout | ||
hq | real(kind=R8P) | in |
Call graph
ensure_londrillo_current_solver_cache
Factor the interior face map plus one checkerboard constraint per line.
fortran
subroutine ensure_londrillo_current_solver_cache(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout |
Call graph
solve_pic_charge_conserving_current_londrillo
Londrillo et al. 2010 (P = I, rho unfiltered): integrate Esirkepov's directional charge changes to faces and invert D = G A along every line, the collocated null mode of A fixed by the checkerboard constraint.
fortran
subroutine solve_pic_charge_conserving_current_londrillo(self, q, hq)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | ||
q | real(kind=R8P) | inout | ||
hq | real(kind=R8P) | in |
Call graph
modified_kernels
P and Q kernels of the matched current in use (matched_kernels of prism_pic_object).
fortran
subroutine modified_kernels(self, p, qw, radius, qfirst, nq)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
p | real(kind=R8P) | out | ||
qw | real(kind=R8P) | out | ||
radius | integer(kind=I4P) | out | ||
qfirst | integer(kind=I4P) | out | ||
nq | integer(kind=I4P) | out |
Call graph
filter_modified_axis
Zero extension is used only outside the block; supported particles stay in the bulk.
fortran
subroutine filter_modified_axis(input, output, axis, p, radius)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
input | real(kind=R8P) | in | ||
output | real(kind=R8P) | out | ||
axis | integer(kind=I4P) | in | ||
p | real(kind=R8P) | in | ||
radius | integer(kind=I4P) | in |
Call graph
filter_matched_box_axis
Convolution along one axis of the matched box current, output_c = sum_t w(t) input_{c+first+t}: circular along a periodic axis (the fold of deposit_matched_current), zero extension otherwise (supports stay off the non-periodic faces, check_matched_support). Q: w = qw(0:nq-1), first = qfirst (faces to cells, face f stored at cell f); P: w = p(-radius:radius), first = -radius. FNL twin: box_filter_axis.
fortran
subroutine filter_matched_box_axis(input, output, axis, w, first, periodic)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
input | real(kind=R8P) | in | ||
output | real(kind=R8P) | out | ||
axis | integer(kind=I4P) | in | ||
w | real(kind=R8P) | in | ||
first | integer(kind=I4P) | in | ||
periodic | logical | in |
Call graph
filter_matched_passes
The P or Q kernel of the matched current along one axis as the passes of matched_factors (issue #112, M3 F2), each a filter_matched_box_axis: fa in, fa out (fb scratch). Equal to the single convolution up to roundoff (zero extension between the passes only near a non-periodic face, which no support reaches).
fortran
subroutine filter_matched_passes(self, kernel, fa, fb, axis)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
kernel | character(len=1) | in | ||
fa | real(kind=R8P) | inout | ||
fb | real(kind=R8P) | inout | ||
axis | integer(kind=I4P) | in |
Call graph
matched_shape_1d
Base-shape weights of the matched current and charge along one axis, on the cells ic-radius..ic+radius: closed B-spline (bspline_closed_weights) or Gaussian normalized on the stencil, as compute_pic_esirkepov_displacement. Cell indices are unwrapped (any i, center emin+(i-1/2)dx), so that a shape across a periodic face is built in one piece and folded afterwards; the current and the charge take the same weights, so the continuity is exact to roundoff.
fortran
subroutine matched_shape_1d(self, axis, b, x, ic, radius, w)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
axis | integer(kind=I4P) | in | ||
b | integer(kind=I4P) | in | ||
x | real(kind=R8P) | in | ||
ic | integer(kind=I4P) | in | ||
radius | integer(kind=I4P) | in | ||
w | real(kind=R8P) | out |
Call graph
check_matched_support
Along a non-periodic axis the cells lo..hi of a particle support, widened by the P taps, must stay inside the block.
fortran
subroutine check_matched_support(self, lo, hi)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
lo | integer(kind=I4P) | in | ||
hi | integer(kind=I4P) | in |
Call graph
fold_matched_cell
Fold an unwrapped cell into the block interior along the periodic axes; along the others it must be inside.
fortran
subroutine fold_matched_cell(self, idx)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
idx | integer(kind=I4P) | inout |
Call graph
deposit_matched_current
Matched current (totorica, esirkepov_Q<N>) of the trajectories q_ref -> q_to, folded into the block interior: J_d = Q_d P_e1 P_e2 F_d^E, F_d^E(f) = -dx_d/dt sum_{i<=f} W_d(i), W_d being Esirkepov's directional charge change. W_d = rho_q dL (x) [t0 (x) (s0 + ds/2) + dt (x) (s0/2 + ds/3)], with dL, t0, dt, s0, ds the 1-D weights (and their changes) along d and the transverse axes e1 < e2. Q and P are finite shift-invariant stencils, so they commute with the sum over the particles: each particle deposits only F_d^E on its box (face f stored at cell f), then Q_d P_e1 P_e2 are applied once on the block (filter_matched_box_axis, circular along the periodic axes). The prefix sum stays per particle: F_d^E vanishes past the box (sum of dL = 0, its roundoff residual cut as the zero-flux closure of the line solve did), so the current of a particle is exactly zero outside its box widened by the P and Q taps (no tails between particles) and the current through a periodic face is kept; a prefix sum on the grid would make J nonlocal and lose that k = 0 mode. Cells are unwrapped and folded modulo n along the periodic axes on writing. In exact arithmetic it equals the line solve of the summed source (solve_pic_charge_conserving_current_modified). Single block (check_conserving_single_block). FNL twin: deposit_matched_current_box.
fortran
subroutine deposit_matched_current(self, q_ref, q_to, jc)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | ||
q_ref | real(kind=R8P) | in | ||
q_to | real(kind=R8P) | in | ||
jc | real(kind=R8P) | out | Current (3, ni, nj, nk, nb), block interior. |
Call graph
store_matched_current
Write a matched current (block interior) into q and set its ghosts as the line solves did (impose_odd_current_ghosts).
fortran
subroutine store_matched_current(self, q, jc)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | ||
q | real(kind=R8P) | inout | ||
jc | real(kind=R8P) | in |
Call graph
deposit_matched_charge_box
Matched charge rho = P S rho^P of totorica and esirkepov_Q<N>: the unfiltered base shape (on the dual nodes x_c+dx/2 for the odd esirkepov_Q<N>, i.e. the particle seen at x-dx/2) filtered by P along every axis. P is a finite shift-invariant stencil, so it commutes with the sum over the particles: each particle deposits only its base shape, from the 1-D weights of matched_shape_1d (those of the matched current), folded into the block interior along the periodic axes as deposit_matched_current (the deposit with periodic faces), then P is applied once on the block along every axis (filter_matched_box_axis, circular along the periodic axes). Ghosts are zero. FNL twin: deposit_matched_charge_box.
fortran
subroutine deposit_matched_charge_box(self, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | ||
q | real(kind=R8P) | inout |
Call graph
deposit_pic_modified_charge
Deposit the unfiltered particle shape, then apply P_c=Q A in all directions.
fortran
subroutine deposit_pic_modified_charge(self, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | ||
q | real(kind=R8P) | inout |
Call graph
initialize_pic_conserving_current_time_zero
Deposit the current at t=0 using the same trajectory operator as the PIC evolution.
fortran
subroutine initialize_pic_conserving_current_time_zero(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout |
Call graph
check_conserving_single_block
The CPU charge-conserving current is single-block by design (line solves and P/Q filters per block); the multi-block version is FNL-only (prism_fnl_pic_conserving_object, virtual-block solves).
fortran
subroutine check_conserving_single_block(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in |
Call graph
modified_current_line
F^E is the face prefix sum of the directional Esirkepov charge change.
fortran
subroutine modified_current_line(self, source, dir, b, n, qw, qfirst, nq, sol)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | ||
source | real(kind=R8P) | in | ||
dir | integer(kind=I4P) | in | ||
b | integer(kind=I4P) | in | ||
n | integer(kind=I4P) | in | ||
qw | real(kind=R8P) | in | ||
qfirst | integer(kind=I4P) | in | ||
nq | integer(kind=I4P) | in | ||
sol | real(kind=R8P) | out |
Call graph
solve_pic_charge_conserving_current_modified
J_d=Q_d P_transverse F_d^E; no inverse reconstruction or line solve.
fortran
subroutine solve_pic_charge_conserving_current_modified(self, q, hq)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | ||
q | real(kind=R8P) | inout | ||
hq | real(kind=R8P) | in |
Call graph
solve_modified_current_with_cleanup
Reconstruct one particle's SSP source at a time, clean its matched current, then accumulate.
fortran
subroutine solve_modified_current_with_cleanup(self, q, q_ref, q_to_history, active_stage, mixed_source)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | ||
q | real(kind=R8P) | inout | ||
q_ref | real(kind=R8P) | in | ||
q_to_history | real(kind=R8P) | in | ||
active_stage | integer(kind=I4P) | in | ||
mixed_source | real(kind=R8P) | in | optional |
Call graph
cleanup_modified_particle_current
Zero only sub-threshold leakage outside the exact P/Q-expanded source support.
fortran
subroutine cleanup_modified_particle_current(self, q_particle, particle, block, shape_lo, shape_hi)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
q_particle | real(kind=R8P) | inout | ||
particle | integer(kind=I4P) | in | ||
block | integer(kind=I4P) | in | ||
shape_lo | integer(kind=I4P) | in | ||
shape_hi | integer(kind=I4P) | in |
Call graph
report_particle_tail_error
fortran
subroutine report_particle_tail_error(particle, component, block, i, j, k, value, j_ref, ratio, lo, hi)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
particle | integer(kind=I4P) | in | ||
component | integer(kind=I4P) | in | ||
block | integer(kind=I4P) | in | ||
i | integer(kind=I4P) | in | ||
j | integer(kind=I4P) | in | ||
k | integer(kind=I4P) | in | ||
value | real(kind=R8P) | in | ||
j_ref | real(kind=R8P) | in | ||
ratio | real(kind=R8P) | in | ||
lo | integer(kind=I4P) | in | ||
hi | integer(kind=I4P) | in |
Call graph
build_esirkepov_face_line
fortran
subroutine build_esirkepov_face_line(self, source, dir, b, n, flux)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | ||
source | real(kind=R8P) | in | ||
dir | integer(kind=I4P) | in | ||
b | integer(kind=I4P) | in | ||
n | integer(kind=I4P) | in | ||
flux | real(kind=R8P) | out |
Call graph
update_esirkepov_face_residual
Check the reconstructed flux on both boundary faces and every interior face.
fortran
subroutine update_esirkepov_face_residual(self, n, sol, flux)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | ||
n | integer(kind=I4P) | in | ||
sol | real(kind=R8P) | in | ||
flux | real(kind=R8P) | in |
Call graph
find_pic_position_cell
Locate one PIC position on the local Cartesian block grid.
fortran
subroutine find_pic_position_cell(self, q_pos, b, i, j, k)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
q_pos | real(kind=R8P) | in | ||
b | integer(kind=I4P) | out | ||
i | integer(kind=I4P) | out | ||
j | integer(kind=I4P) | out | ||
k | integer(kind=I4P) | out |
Call graph
particle_weighting_radius
Integer support radius for the configured particle shape.
fortran
subroutine particle_weighting_radius(self, b, rx, ry, rz)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
b | integer(kind=I4P) | in | ||
rx | integer(kind=I4P) | out | ||
ry | integer(kind=I4P) | out | ||
rz | integer(kind=I4P) | out |
Call graph
particle_shape_weight_1d
One-dimensional particle shape used by the PIC charge deposition.
fortran
subroutine particle_shape_weight_1d(self, model, x, xc, dx, w, cutoff_limit)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
model | character(len=*) | in | ||
x | real(kind=R8P) | in | ||
xc | real(kind=R8P) | in | ||
dx | real(kind=R8P) | in | ||
w | real(kind=R8P) | out | ||
cutoff_limit | real(kind=R8P) | in | optional |
Call graph
build_centered_reconstruction_matrix
Build face-reconstruction matrix R such that FD1_CC J = (R_{i+1/2}-R_{i-1/2})/dx.
fortran
subroutine build_centered_reconstruction_matrix(self, n, a)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
n | integer(kind=I4P) | in | ||
a | real(kind=R8P) | inout |
Call graph
factorize_matrix_pivot
fortran
subroutine factorize_matrix_pivot(a, pivot, n)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
a | real(kind=R8P) | inout | ||
pivot | integer(kind=I4P) | out | ||
n | integer(kind=I4P) | in |
Call graph
solve_factored_matrix_pivot
fortran
subroutine solve_factored_matrix_pivot(a, pivot, rhs, sol, n)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
a | real(kind=R8P) | in | ||
pivot | integer(kind=I4P) | in | ||
rhs | real(kind=R8P) | in | ||
sol | real(kind=R8P) | out | ||
n | integer(kind=I4P) | in |
Call graph
odd_mirror_index
fortran
subroutine odd_mirror_index(idx, n, col, sgn)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
idx | integer(kind=I4P) | in | ||
n | integer(kind=I4P) | in | ||
col | integer(kind=I4P) | out | ||
sgn | real(kind=R8P) | out |
Call graph
impose_zero_current_ghosts
Zero the normal current in the physical boundary ghosts (rows of local_map_bc_crown). The ghosts of block interfaces and of periodic faces keep the exchanged current.
fortran
subroutine impose_zero_current_ghosts(self, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
q | real(kind=R8P) | inout |
Call graph
impose_odd_current_ghosts
Zero normal face flux: J outside the face is the odd mirror of J inside. Along a periodic axis the ghosts are the periodic images instead (single block: the opposite interior of the same block).
fortran
subroutine impose_odd_current_ghosts(self, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
q | real(kind=R8P) | inout |
Call graph
integrate_rk_yoshida
Integrate equation, time operator, Yoshida RK scheme: SELAH's yoshida-4 splitting (#132 phase 4), its 7 flows alternating the partitions B (VAR_BX:VAR_BZ, first) and D (VAR_DX:VAR_DZ), a residual per flow on q, the flow's partition advanced by its fraction of the step (the interior cells; not masked, as before).
fortran
subroutine integrate_rk_yoshida(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
ts_begin_step
Open the stepper's step on q; the solid cells are masked with immersed solids.
fortran
subroutine ts_begin_step(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_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_cpu_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 here); masked with immersed solids.
fortran
subroutine ts_end_stage(self, s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_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, with the step residual in dq when asked (as the former update_q, whose callers asked for it on the unmasked SSP path only).
fortran
subroutine ts_finish_step(self, with_dq)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. | |
with_dq | logical | in | Compute the step residual into dq. |
Call graph
copy_stage_state
Copy the stepper's stage state, ghosts included, into q (the PIC stage scratch, as q_rk(:,...,s) was).
fortran
subroutine copy_stage_state(self, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | The equation. | |
q | real(kind=R8P) | inout | Copy. |
Call graph
compute_dxyz_min
Compute minimum dxyz space step.
fortran
subroutine compute_dxyz_min(blocks_number, dxyz, dxyz_min)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
blocks_number | integer(kind=I4P) | in | Number of blocks. | |
dxyz | real(kind=R8P) | in | XYZ space steps. | |
dxyz_min | real(kind=R8P) | out | Minimum space step. |
Call graph
compute_fluxes_convective_weno
Compute convective fluxes along direction dir, WENO scheme for space operator.
Host dispatcher (issue #139, S5, decision D3: the dispatch structure of FLUME's kernels): the kernel of the WENO half-width weno_s, compiled with S a named constant (_s1 ... _s5), whose one body (adam_prism_cpu_weno_fluxes_body.INC) holds the face loops with the flux decomposition and the reconstruction by SETH's WENO-JS kernel of that width, renamed weno_width, with SETH's descaler.
fortran
subroutine compute_fluxes_convective_weno(dir, blocks_number, ni, nj, nk, ngc, nv_c, weno_s, weno_eps, weno_sigma, evmax, erw, elw, chi, q, fluxes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
dir | integer(kind=I4P) | in | Direction, 1=X, 2=Y, 3=Z. | |
blocks_number | integer(kind=I4P) | in | Number of blocks. | |
ni | integer(kind=I4P) | in | Grid cells number in I direction. | |
nj | integer(kind=I4P) | in | Grid cells number in J direction. | |
nk | integer(kind=I4P) | in | Grid cells number in K direction. | |
ngc | integer(kind=I4P) | in | Ghost cells number. | |
nv_c | integer(kind=I4P) | in | Number of conservative varibales. | |
weno_s | integer(kind=I4P) | in | Weno stencils number/dimension. | |
weno_eps | real(kind=R8P) | in | Regulariser of the WENO smoothness indicators. | |
weno_sigma | real(kind=R8P) | in | WENO descaler switch (0 Jiang-Shu, 1 scale-invariant). | |
evmax | real(kind=R8P) | in | Maximum waves speed estimation. | |
erw | real(kind=R8P) | in | Right eigenvectors for WENO reconstruction. | |
elw | real(kind=R8P) | in | Left eigenvectors for WENO reconstruction. | |
chi | real(kind=R8P) | in | Speed parameter for divergence cleaning. | |
q | real(kind=R8P) | in | Field variables. | |
fluxes | real(kind=R8P) | inout | Fluxes. |
Call graph
compute_fluxes_convective_weno_s1
compute_fluxes_convective_weno for WENO-1: the stencil half-width S = 1 is a compile-time constant.
fortran
subroutine compute_fluxes_convective_weno_s1(dir, blocks_number, ni, nj, nk, ngc, nv_c, weno_eps, weno_sigma, evmax, erw, elw, chi, q, fluxes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
dir | integer(kind=I4P) | in | Direction, 1=X, 2=Y, 3=Z. | |
blocks_number | integer(kind=I4P) | in | Number of blocks. | |
ni | integer(kind=I4P) | in | Grid cells number in I direction. | |
nj | integer(kind=I4P) | in | Grid cells number in J direction. | |
nk | integer(kind=I4P) | in | Grid cells number in K direction. | |
ngc | integer(kind=I4P) | in | Ghost cells number. | |
nv_c | integer(kind=I4P) | in | Number of conservative varibales. | |
weno_eps | real(kind=R8P) | in | Regulariser of the WENO smoothness indicators. | |
weno_sigma | real(kind=R8P) | in | WENO descaler switch (0 Jiang-Shu, 1 scale-invariant). | |
evmax | real(kind=R8P) | in | Maximum waves speed estimation. | |
erw | real(kind=R8P) | in | Right eigenvectors for WENO reconstruction. | |
elw | real(kind=R8P) | in | Left eigenvectors for WENO reconstruction. | |
chi | real(kind=R8P) | in | Speed parameter for divergence cleaning. | |
q | real(kind=R8P) | in | Field variables. | |
fluxes | real(kind=R8P) | inout | Fluxes. |
Call graph
compute_fluxes_convective_weno_s2
compute_fluxes_convective_weno for WENO-3: the stencil half-width S = 2 is a compile-time constant.
fortran
subroutine compute_fluxes_convective_weno_s2(dir, blocks_number, ni, nj, nk, ngc, nv_c, weno_eps, weno_sigma, evmax, erw, elw, chi, q, fluxes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
dir | integer(kind=I4P) | in | Direction, 1=X, 2=Y, 3=Z. | |
blocks_number | integer(kind=I4P) | in | Number of blocks. | |
ni | integer(kind=I4P) | in | Grid cells number in I direction. | |
nj | integer(kind=I4P) | in | Grid cells number in J direction. | |
nk | integer(kind=I4P) | in | Grid cells number in K direction. | |
ngc | integer(kind=I4P) | in | Ghost cells number. | |
nv_c | integer(kind=I4P) | in | Number of conservative varibales. | |
weno_eps | real(kind=R8P) | in | Regulariser of the WENO smoothness indicators. | |
weno_sigma | real(kind=R8P) | in | WENO descaler switch (0 Jiang-Shu, 1 scale-invariant). | |
evmax | real(kind=R8P) | in | Maximum waves speed estimation. | |
erw | real(kind=R8P) | in | Right eigenvectors for WENO reconstruction. | |
elw | real(kind=R8P) | in | Left eigenvectors for WENO reconstruction. | |
chi | real(kind=R8P) | in | Speed parameter for divergence cleaning. | |
q | real(kind=R8P) | in | Field variables. | |
fluxes | real(kind=R8P) | inout | Fluxes. |
Call graph
compute_fluxes_convective_weno_s3
compute_fluxes_convective_weno for WENO-5: the stencil half-width S = 3 is a compile-time constant.
fortran
subroutine compute_fluxes_convective_weno_s3(dir, blocks_number, ni, nj, nk, ngc, nv_c, weno_eps, weno_sigma, evmax, erw, elw, chi, q, fluxes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
dir | integer(kind=I4P) | in | Direction, 1=X, 2=Y, 3=Z. | |
blocks_number | integer(kind=I4P) | in | Number of blocks. | |
ni | integer(kind=I4P) | in | Grid cells number in I direction. | |
nj | integer(kind=I4P) | in | Grid cells number in J direction. | |
nk | integer(kind=I4P) | in | Grid cells number in K direction. | |
ngc | integer(kind=I4P) | in | Ghost cells number. | |
nv_c | integer(kind=I4P) | in | Number of conservative varibales. | |
weno_eps | real(kind=R8P) | in | Regulariser of the WENO smoothness indicators. | |
weno_sigma | real(kind=R8P) | in | WENO descaler switch (0 Jiang-Shu, 1 scale-invariant). | |
evmax | real(kind=R8P) | in | Maximum waves speed estimation. | |
erw | real(kind=R8P) | in | Right eigenvectors for WENO reconstruction. | |
elw | real(kind=R8P) | in | Left eigenvectors for WENO reconstruction. | |
chi | real(kind=R8P) | in | Speed parameter for divergence cleaning. | |
q | real(kind=R8P) | in | Field variables. | |
fluxes | real(kind=R8P) | inout | Fluxes. |
Call graph
compute_fluxes_convective_weno_s4
compute_fluxes_convective_weno for WENO-7: the stencil half-width S = 4 is a compile-time constant.
fortran
subroutine compute_fluxes_convective_weno_s4(dir, blocks_number, ni, nj, nk, ngc, nv_c, weno_eps, weno_sigma, evmax, erw, elw, chi, q, fluxes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
dir | integer(kind=I4P) | in | Direction, 1=X, 2=Y, 3=Z. | |
blocks_number | integer(kind=I4P) | in | Number of blocks. | |
ni | integer(kind=I4P) | in | Grid cells number in I direction. | |
nj | integer(kind=I4P) | in | Grid cells number in J direction. | |
nk | integer(kind=I4P) | in | Grid cells number in K direction. | |
ngc | integer(kind=I4P) | in | Ghost cells number. | |
nv_c | integer(kind=I4P) | in | Number of conservative varibales. | |
weno_eps | real(kind=R8P) | in | Regulariser of the WENO smoothness indicators. | |
weno_sigma | real(kind=R8P) | in | WENO descaler switch (0 Jiang-Shu, 1 scale-invariant). | |
evmax | real(kind=R8P) | in | Maximum waves speed estimation. | |
erw | real(kind=R8P) | in | Right eigenvectors for WENO reconstruction. | |
elw | real(kind=R8P) | in | Left eigenvectors for WENO reconstruction. | |
chi | real(kind=R8P) | in | Speed parameter for divergence cleaning. | |
q | real(kind=R8P) | in | Field variables. | |
fluxes | real(kind=R8P) | inout | Fluxes. |
Call graph
compute_fluxes_convective_weno_s5
compute_fluxes_convective_weno for WENO-9: the stencil half-width S = 5 is a compile-time constant.
fortran
subroutine compute_fluxes_convective_weno_s5(dir, blocks_number, ni, nj, nk, ngc, nv_c, weno_eps, weno_sigma, evmax, erw, elw, chi, q, fluxes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
dir | integer(kind=I4P) | in | Direction, 1=X, 2=Y, 3=Z. | |
blocks_number | integer(kind=I4P) | in | Number of blocks. | |
ni | integer(kind=I4P) | in | Grid cells number in I direction. | |
nj | integer(kind=I4P) | in | Grid cells number in J direction. | |
nk | integer(kind=I4P) | in | Grid cells number in K direction. | |
ngc | integer(kind=I4P) | in | Ghost cells number. | |
nv_c | integer(kind=I4P) | in | Number of conservative varibales. | |
weno_eps | real(kind=R8P) | in | Regulariser of the WENO smoothness indicators. | |
weno_sigma | real(kind=R8P) | in | WENO descaler switch (0 Jiang-Shu, 1 scale-invariant). | |
evmax | real(kind=R8P) | in | Maximum waves speed estimation. | |
erw | real(kind=R8P) | in | Right eigenvectors for WENO reconstruction. | |
elw | real(kind=R8P) | in | Left eigenvectors for WENO reconstruction. | |
chi | real(kind=R8P) | in | Speed parameter for divergence cleaning. | |
q | real(kind=R8P) | in | Field variables. | |
fluxes | real(kind=R8P) | inout | Fluxes. |
Call graph
compute_fluxes_difference
Compute fluxes difference.
fortran
subroutine compute_fluxes_difference(blocks_number, ni, nj, nk, ngc, nv_c, var_Jx, var_Jy, var_Jz, phi_ivar, psi_ivar, rho_ivar, use_rho, chi_wave2, alpha, dx, dy, dz, flx, fly, flz, q, dq)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
blocks_number | integer(kind=I4P) | in | Number of blocks. | |
ni | integer(kind=I4P) | in | Grid cells number in I direction. | |
nj | integer(kind=I4P) | in | Grid cells number in J direction. | |
nk | integer(kind=I4P) | in | Grid cells number in K direction. | |
ngc | integer(kind=I4P) | in | Ghost cells number. | |
nv_c | integer(kind=I4P) | in | Number of conservative varibales in q. | |
var_Jx | integer(kind=I4P) | in | Current variable indices. | |
var_Jy | integer(kind=I4P) | in | Current variable indices. | |
var_Jz | integer(kind=I4P) | in | Current variable indices. | |
phi_ivar | integer(kind=I4P) | in | ||
psi_ivar | integer(kind=I4P) | in | ||
rho_ivar | integer(kind=I4P) | in | ||
use_rho | logical | in | ||
chi_wave2 | real(kind=R8P) | in | ||
alpha | real(kind=R8P) | in | ||
dx | real(kind=R8P) | in | Space steps. | |
dy | real(kind=R8P) | in | Space steps. | |
dz | real(kind=R8P) | in | Space steps. | |
flx | real(kind=R8P) | in | X direction fluxes. | |
fly | real(kind=R8P) | in | Y direction fluxes. | |
flz | real(kind=R8P) | in | Z direction fluxes. | |
q | real(kind=R8P) | in | Fields. | |
dq | real(kind=R8P) | inout | Fluxes differences. |
Call graph
compute_field_mean_value
Compute mean value of the field in a certain region of the domain.
fortran
subroutine compute_field_mean_value(self, q, n_x, n_y, n_z, n_b, mean_value)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | The object | |
q | real(kind=R8P) | in | Field variables. | |
n_x | integer(kind=I4P) | in | Number of cells in each direction and number of blocks | |
n_y | integer(kind=I4P) | in | Number of cells in each direction and number of blocks | |
n_z | integer(kind=I4P) | in | Number of cells in each direction and number of blocks | |
n_b | integer(kind=I4P) | in | Number of cells in each direction and number of blocks | |
mean_value | real(kind=R8P) | out | Mean value of the field out of the fWLayer |
Functions
is_face_line_seed_cpu
Attributes: pure
Returns: logical
fortran
function is_face_line_seed_cpu(face, i, j, k, ni, nj, nk) result(is_seed)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
face | integer(kind=I4P) | in | ||
i | integer(kind=I4P) | in | ||
j | integer(kind=I4P) | in | ||
k | integer(kind=I4P) | in | ||
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in |
Call graph
face_normal_direction_cpu
Attributes: pure
Returns: integer(kind=i4p)
fortran
function face_normal_direction_cpu(face) result(dir_n)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
face | integer(kind=I4P) | in |
Call graph
silver_muller_unknown_coefficient_cpu
Attributes: pure
Returns: real(kind=r8p)
fortran
function silver_muller_unknown_coefficient_cpu(face, m, hs, ds) result(coeff)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
face | integer(kind=I4P) | in | ||
m | integer(kind=I4P) | in | ||
hs | integer(kind=I4P) | in | ||
ds | real(kind=R8P) | in |
Call graph
tangential_divergence_at_cell_cpu
Attributes: pure
Returns: real(kind=r8p)
fortran
function tangential_divergence_at_cell_cpu(q, ngc, b, i, j, k, hs, dxyz, dir_t1, dir_t2, var_t1, var_t2) result(div_t)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
q | real(kind=R8P) | in | ||
ngc | integer(kind=I4P) | in | ||
b | integer(kind=I4P) | in | ||
i | integer(kind=I4P) | in | ||
j | integer(kind=I4P) | in | ||
k | integer(kind=I4P) | in | ||
hs | integer(kind=I4P) | in | ||
dxyz | real(kind=R8P) | in | ||
dir_t1 | integer(kind=I4P) | in | ||
dir_t2 | integer(kind=I4P) | in | ||
var_t1 | integer(kind=I4P) | in | ||
var_t2 | integer(kind=I4P) | in |
Call graph
normal_known_contribution_cpu
Attributes: pure
Returns: real(kind=r8p)
fortran
function normal_known_contribution_cpu(q, ngc, ni, nj, nk, b, face, i, j, k, hs, dxyz, var_n) result(div_n_known)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
q | real(kind=R8P) | in | ||
ngc | integer(kind=I4P) | in | ||
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in | ||
b | integer(kind=I4P) | in | ||
face | integer(kind=I4P) | in | ||
i | integer(kind=I4P) | in | ||
j | integer(kind=I4P) | in | ||
k | integer(kind=I4P) | in | ||
hs | integer(kind=I4P) | in | ||
dxyz | real(kind=R8P) | in | ||
var_n | integer(kind=I4P) | in |
Call graph
normal_depth_from_cell_cpu
Attributes: pure
Returns: integer(kind=i4p)
fortran
function normal_depth_from_cell_cpu(face, i, j, k, ni, nj, nk) result(depth)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
face | integer(kind=I4P) | in | ||
i | integer(kind=I4P) | in | ||
j | integer(kind=I4P) | in | ||
k | integer(kind=I4P) | in | ||
ni | integer(kind=I4P) | in | ||
nj | integer(kind=I4P) | in | ||
nk | integer(kind=I4P) | in |
Call graph
component_along_direction_cpu
Attributes: pure
Returns: real(kind=r8p)
fortran
function component_along_direction_cpu(q, ngc, b, var, dir, i, j, k, offset) result(value_)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
q | real(kind=R8P) | in | ||
ngc | integer(kind=I4P) | in | ||
b | integer(kind=I4P) | in | ||
var | integer(kind=I4P) | in | ||
dir | integer(kind=I4P) | in | ||
i | integer(kind=I4P) | in | ||
j | integer(kind=I4P) | in | ||
k | integer(kind=I4P) | in | ||
offset | integer(kind=I4P) | in |
Call graph
stages_per_step_forest
Number of integrator stages this realm exposes per step.
For the multi-realm path the forest drives the stage loop, so it needs to know K up front. ONLY runge-kutta-ssp-* is split into per-stage TBPs (begin_stage_forest / end_stage_forest): the staged protocol needs every stage on a register of its own (SELAH's Butcher form, ts%is_butcher()), which the two-register schemes (runge-kutta-1/2/3) and the Yoshida splitting do not have (issue #25: low-storage schemes once passed this gate silently and crashed far downstream). The forest queries this TBP only on the STAGED branch, so refusing here leaves the fused N=1/no-seam fast path — where those schemes run — untouched. Leapfrog, Blanes-Moan and CFM are refused at initialization (moved to SELAH, szaghi/SELAH#3).
Returns: integer(kind=I4P)
fortran
function stages_per_step_forest(self) result(K)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | The realm. |
Call graph
compute_pml_kappa
Attributes: pure
Returns: real(kind=r8p)
fortran
function compute_pml_kappa(self, center_distance, span) result(kappa)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | ||
center_distance | real(kind=R8P) | in | ||
span | real(kind=R8P) | in |
Call graph
pic_box
The particles' companion box: the active particles, every component (q_pic(8, capacity)).
Returns: type(box)
fortran
function pic_box(self) result(bx)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | The equation. |
Call graph
modified_filter_radius
Cells reached by the P filter, plus one for the half-cell shift of the odd filters (boundary margin).
Returns: integer(kind=i4p)
fortran
function modified_filter_radius(self) result(radius)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in |
Call graph
modified_position_shift
Odd esirkepov_Q<N> deposit the base shape on the dual nodes x_c+dx/2 (P has an even number of taps, dual nodes to centers): this equals the regular deposit of the particle at x-dx/2. Zero for the even filters and the other solvers.
Returns: real(kind=R8P)
fortran
function modified_position_shift(self) result(shift)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in |
Call graph
dotproduct
Compute the scalar (dot) product.
Returns: real(kind=R8P)
fortran
function dotproduct(a, b) result(dot)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
a | real(kind=R8P) | in | Left hand side. | |
b | real(kind=R8P) | in | Left hand side. |
crossproduct
Returns: real(kind=R8P)
fortran
function crossproduct(a, b) result(cross)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
a | real(kind=R8P) | in | Left hand side. | |
b | real(kind=R8P) | in | Left hand side. |