Appearance
adam_flume_fnl_object
ADAM, FLUME FNL (OpenACC / OpenMP offload) backend object.
Implements the forest contract on the device. The state lives on the device for the whole run in the transposed layout (b, i, j, k, v); full-field device-to-host copies happen only on save steps. The FNL helpers (field, IB, RK, WENO) are per-realm components initialized after the common initialization from the realm's own objects; mpih_fnl is the only FNL singleton and is initialized once per process. Space operator: characteristic (or conservative) WENO flux splitting, face fluxes then flux difference (issue #35, section 3.4); the per-face physics is the shared adam_flume_euler_library, so only the kernels are FNL-specific.
Source: src/app/flume/fnl/adam_flume_fnl_object.F90
Dependencies
Contents
- equilibrium_seam_face
- flume_fnl_object
- accumulate_seam_fluxes
- flag_troubled_seam_cells
- add_dissipative_fluxes_dev
- apply_floors
- allocate_gpu
- check_nonfinite
- check_glm_ch
- compute_conservation
- apply_forcing
- update_hybrid_sensor
- overwrite_hybrid_fluxes
- update_wall_model_faces
- close_noslip_fluxes
- overwrite_wall_model_fluxes
- update_hybrid_faces
- compute_mu_t
- update_sgs_lambda
- compute_turbulence_history
- compute_divb_history
- compute_dflux_norms
- compute_q_aux
- copy_cpu_gpu
- wm_filter_to_host
- wm_filter_to_device
- copy_gpu_cpu
- copy_phi_gpu
- refresh_potential
- copy_potential_gpu
- solve_potential_gpu
- destroy
- initialize_flume
- limit_positivity_dev
- seam_lists
- seam_sync_fluxes_dev
- seam_sync_factors_dev
- seam_sync_theta_dev
- seam_sync_blend_dev
- save_residuals
- save_simulation_data
- set_boundary_conditions
- build_bc_pass_rows
- inflow_df_to_device
- wall_history_to_host
- inflow_rr_gather
- inflow_rr_to_device
- free_inflow_rr_rows
- free_inflow_df_rows
- update_ghost
- advance_one_step_forest
- after_topology_build_forest
- apply_reflux_to_stage_forest
- begin_stage_forest
- close_step_forest
- compute_local_dt_forest
- end_stage_forest
- reflux_stage
- fill_seam_from_peer_forest
- pack_seam_cells_forest
- unpack_seam_cells_forest
- finalize_forest
- initialize_process_context
- finalize_mpi_forest
- initialize_app_forest
- restart_state_forest
- amr_update_initial_forest
- rebalance_initial_forest
- post_initial_state_forest
- is_done_forest
- open_step_forest
- seam_ghosts_to_state
- post_step_forest
- sync_dual_energy
- refresh_sink_accelerations_fnl
- apply_cooling
- accrete_sinks_gpu
- cooling_tables
- regrid_forest
- regrid_begin_forest
- regrid_mark_forest
- regrid_apply_forest
- regrid_end_forest
- copy_blocks_transposed
- refresh_equilibrium_residual
- compute_gravity_correction
- compute_residuals_weno_dev
- compute_residuals_riemann_dev
- integrate_rk_ls_dev
- integrate_rk_ssp_dev
- ts_begin_step
- ts_begin_stage
- ts_end_stage
- ts_finish_step
- seam_gather_cells
- seam_gather_stencils
- seam_gather_faces
- seam_scatter_faces
- seam_scatter_cells
- cooling_time_min
- stages_per_step_forest
Derived Types
equilibrium_seam_face
The equilibrium's flux mismatch of one register face, F_coarse - F_fine_sum per skin cell (issue #73, M7-G2b).
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
d | real(kind=R8P) | allocatable | Mismatch [nv, nface_cells]. |
flume_fnl_object
FLUME FNL backend object.
Inheritance
Extends: flume_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. |
amr_locked_ | logical | Runtime AMR locked after initialization. | |
regrid_phase | type(regrid_phases_t) | The state of the current runtime regrid (issue #110). | |
amr_criteria | type(amr_criterion_pointer) | allocatable | Registered refinement criteria (issue #110, P4). |
amr_marker_list | type(amr_criterion_pointer) | allocatable | The [amr_marker_N] criteria, in input order: built-in and registered (issue #110, P4.2). |
ib_maps | type(maps_object) | The ghost maps restricted to the cells the eikonal sweeps read (#156 L2): ghost layer 1 next to a solid cell, on a block face. | |
ib_maps_generation | integer(kind=I4P) | Builds of ib_maps so far (a backend copy follows it). | |
save_auxiliary_fields | logical | Save the auxiliary variables with the fields. | |
glm_speed_reported | real(kind=R8P) | Largest wave speed above c_h reported so far. | |
divb_reported | real(kind=R8P) | Largest monitored measure above divb_tol reported so far. | |
divb_seam | integer(kind=I4P) | allocatable | Seam faces flags of the div(B) history [nb, 6]. |
q | real(kind=R8P) | allocatable | Conservative variables [nv, 1-ngc:ni+ngc, ..., nb]. |
dq | real(kind=R8P) | allocatable | Residuals [nv, 1-ngc:ni+ngc, ..., nb]. |
q_aux | real(kind=R8P) | allocatable | Auxiliary variables [nv_aux, 1-ngc:ni+ngc, ..., nb]. |
turbulence | type(turbulence_object) | Subgrid-scale model ([turbulence], issue #119, T1). | |
forcing | type(flume_forcing_object) | Mass-flow forcing ([forcing], issue #119, T3.1). | |
wm_faces | integer(kind=I4P) | allocatable | Wall model: block faces it holds [nb, 6] (issue #119, T3.3). |
has_wall_model | logical | Some face of the domain is modelled. | |
ns_faces | integer(kind=I4P) | allocatable | No-slip walls: block faces on them [nb, 6] (issue #119, the #65 mass leak). |
has_noslip | logical | Some face of the domain is a no-slip wall of a hydrodynamic model. | |
wm_avg_x | real(kind=R8P) | allocatable | Wall model input filter: the averaged u, v, w, p, rho and the pressure gradient along u (#121 S4d) on the x faces [6, 2, nj, nk, nb], side 1 low. |
wm_avg_y | real(kind=R8P) | allocatable | The same on the y faces [6, ni, 2, nk, nb]. |
wm_avg_z | real(kind=R8P) | allocatable | The same on the z faces [6, ni, nj, 2, nb]. |
has_wm_filter | logical | Some modelled face filters its samples (wall_model_filter > 0) or its pressure gradient (wall_model_pressure_gradient_filter > 0). | |
wm_avg_nv | integer(kind=I4P) | Averages per wall face: the sample (5), the pressure gradient, and with wall_model_convection the convection of WM_CONV_CELLS cells (#121 P2), and with wall_model_resolved_stress four averages per cell for its resolved stress (#121 P3). | |
has_wm_viscosity | logical | Some modelled face puts its eddy viscosity below the matching height. | |
wm_filter_fresh | logical | The averages hold no history (start, regrid, a checkpoint without them): the next commit takes the sample. | |
wm_filter_it | integer(kind=I4P) | The iteration whose sample the averages hold. | |
hybrid_faces | integer(kind=I4P) | allocatable | Hybrid scheme: block faces it must not read across [nb, 6]. |
hybrid_has_faces | logical | Hybrid scheme: some block of the realm has such a face. | |
sgs_lambda | real(kind=R8P) | Local time step limit of the eddy viscosity. | |
phi_grav | real(kind=R8P) | allocatable | Gravitational potential [1-ngc:ni+ngc, ..., nb] (issue #81); a one-cell placeholder without a potential. |
poisson_wall | real(kind=R8P) | Wall time of the last Poisson solve (s). | |
q_name | type(string) | allocatable | Conservative variables names. |
dq_name | type(string) | allocatable | Residuals names. |
q_aux_name | type(string) | allocatable | Auxiliary variables names. |
bc | type(flume_bc_object) | Boundary conditions. | |
diagnostics | type(flume_diagnostics_object) | Diagnostics. | |
ic | type(flume_ic_object) | Initial conditions. | |
numerics | type(flume_numerics_object) | Numerics. | |
physics | type(flume_physics_object) | Physics. | |
units | type(flume_reference_object) | Reference layer (dimensional input, issue #49). | |
limiter_dt | real(kind=R8P) | Forward-Euler step the positivity limiter makes admissible: the active stage's (#134 D4). | |
flows | type(additive_splitting) | The field step and the post-step flows (cooling, sinks): SELAH's composition (lie, the field first; #134 D4). | |
sinks | type(flume_sinks_object) | Sink particles (issue #94). | |
time | type(flume_time_object) | Time handler. | |
field_fnl | type(field_fnl_object) | Field helper (coordinates, maps, ghost exchange). | |
ib_fnl | type(ib_fnl_object) | Immersed boundary helper. | |
ib_maps_fnl | type(maps_fnl_object) | Device copy of ib_maps, the eikonal sweeps' ghost maps (#156 L2). | |
ib_maps_fnl_generation | integer(kind=I4P) | The ib_maps build the device copy holds (0: none). | |
q_gpu | real(kind=R8P) | pointer | Conservative variables [nb, i, j, k, nv]. |
dq_gpu | real(kind=R8P) | pointer | Residuals [nb, i, j, k, nv]. |
q_aux_gpu | real(kind=R8P) | pointer | Auxiliary variables [nb, i, j, k, nv_aux]. |
hybrid_faces_gpu | integer(kind=I4P) | pointer | Hybrid scheme: block faces it must not read across [nb, 6]. |
wm_faces_gpu | integer(kind=I4P) | pointer | Wall model: block faces [nb, 6]. |
ns_faces_gpu | integer(kind=I4P) | pointer | No-slip walls: block faces [nb, 6]. |
wm_avg_x_gpu | real(kind=R8P) | pointer | Wall model input filter, x faces [nb, 2, nj, nk, 6] (one element without a filter). |
wm_avg_y_gpu | real(kind=R8P) | pointer | The same, y faces [nb, ni, 2, nk, 6]. |
wm_avg_z_gpu | real(kind=R8P) | pointer | The same, z faces [nb, ni, nj, 2, 6]. |
psi_gpu | real(kind=R8P) | pointer | Hybrid sensor [nb, i, j, k, nv], component 1, q-shaped. |
mu_t_gpu | real(kind=R8P) | pointer | Eddy viscosity [nb, i, j, k, 1], with a subgrid-scale model. |
flx_f_gpu | real(kind=R8P) | pointer | X-face fluxes [nb, 0:ni, 1:nj, 1:nk, nv]. |
fly_f_gpu | real(kind=R8P) | pointer | Y-face fluxes [nb, 1:ni, 0:nj, 1:nk, nv]. |
flz_f_gpu | real(kind=R8P) | pointer | Z-face fluxes [nb, 1:ni, 1:nj, 0:nk, nv]. |
gcor_gpu | real(kind=R8P) | pointer | Fourth-order correction of the gravity energy source (issue #73, M7-G2a) [nb, i, j, k, 1]; zero without gravity. |
phi_grav_gpu | real(kind=R8P) | pointer | Gravitational potential (issue #81) [nb, i, j, k, 1]; a one-element placeholder without a potential. |
dq_e_gpu | real(kind=R8P) | pointer | Residual of the hydrostatic equilibrium (issue #73, M7-G2b) [nb, i, j, k, nv]; well-balanced only. |
seam_e | type(equilibrium_seam_face) | allocatable | The equilibrium's 2:1 flux mismatch per register face. |
equilibrium_stale | logical | dq_e_gpu describes another grid (init, regrid). | |
equilibrium_computing | logical | dq_e_gpu is being computed: no subtraction. | |
seam | type(flume_seam_sync_object) | Per-stage seam flux synchronisation of the limiter (issue #50). | |
lam_gpu | real(kind=R8P) | pointer | Positivity limiter cell factors (component 1, q-shaped for the ghost exchange) [nb, i, j, k, nv]; with the limiter. |
q_inflow_gpu | real(kind=R8P) | pointer | Conservative inflow state of each face [nv, 6]. |
df_rows_gpu | integer(kind=I4P) | pointer | Digital-filter inflow: block and cell of each ghost row [4, rows] (#119). |
df_q_gpu | real(kind=R8P) | pointer | Digital-filter inflow: state of each ghost row [5, rows] (#119). |
rr_rows_gpu | integer(kind=I4P) | pointer | Recycling inflow: block and cell of each ghost row [4, rows] (#121, S5). |
rr_q_gpu | real(kind=R8P) | pointer | Recycling inflow: state of each ghost row [5, rows] (#121, S5). |
wall_sign_gpu | real(kind=R8P) | pointer | Wall mirror sign per variable and direction [nv, 3]. |
divb_seam_gpu | integer(kind=I4P) | pointer | Seam faces flags of the div(B) history [nb, 6]. |
bc_rows_gpu | integer(kind=I4P) | pointer | BC crown map rows grouped by pass [rows, ngc] (#90 F-A'). |
bc_pass_range | integer(kind=I4P) | allocatable | First, last entry of each pass in bc_rows_gpu [2, 3, ngc]. |
skin_faces | integer(kind=I4P) | allocatable | Register faces [3, n]: block, fec, column - 1 (#90 F-B). |
skin_faces_gpu | integer(kind=I4P) | pointer | Device copy of skin_faces. |
skins_gpu | real(kind=R8P) | pointer | Packed skins of the register faces [nv, columns]. |
buf_5D_R8P | real(kind=R8P) | allocatable | Transposed copy buffer, extent identical to q_gpu. |
db5 | integer(kind=I4P) | Device bounds of the transposed copies. | |
hb5 | integer(kind=I4P) | Host bounds of the transposed copies. | |
compute_residuals_dev | procedure(compute_residuals_dev_interface) | pass(self), pointer | Space operator. |
integrate_dev | procedure(integrate_dev_interface) | pass(self), pointer | Time operator. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
load_fdv_from_file | pass(self) | Load FDV config from file. |
initialize_forest | pass(self), non_overridable | Invoked by forest%initialize per realm: the template. |
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 (initialization-time only). |
initial_amr_iterations_forest | pass(self) | Template hook: [initial_conditions] AMR passes. |
reset_time_forest | pass(self) | Template hook: time and step counter to zero. |
set_initial_state_forest | pass(self) | Template hook: initial conditions and solids distance. |
runtime_amr_forest | pass(self) | Whether this realm regrids during the run (issue #74). |
mark_by_geometry | pass(self) | Mark blocks to be refined by a primitive geometric box. |
mark_by_gradient | pass(self) | Mark blocks by the gradient of a conservative or auxiliary variable. |
mark_by_solid | pass(self) | Mark blocks crossed by the surface of an immersed solid. |
mark_by_lohner | pass(self) | Mark blocks by the Loehner estimator of a variable (issue #74). |
mark_by_jeans | pass(self) | Mark blocks by the cells per Jeans length (issue #91). |
mark_by_kolmogorov | pass(self) | Mark blocks by the local Kolmogorov resolution r = h/eta (issue #133). |
mark_runtime | pass(self) | Combine the markers into the flags of a runtime regrid (issue #74). |
register_amr_criterion | pass(self) | Register a refinement criterion by name (issue #110, P4). |
check_regridded_state | pass(self) | Stop on an inadmissible state after a regrid (issue #74). |
is_regrid_step | pass(self) | Whether the step just closed is a runtime regrid step (issue #74). |
accumulate_seam_skin | pass(self) | Route one weighted seam face skin to the forest's flux register. |
add_seam_gravity_work | pass(self) | Add the seam gravity work of self-gravity to a seam skin. |
allocate_common | pass(self) | Allocate common data. |
compute_fields_number | pass(self) | Compute the block-sized fields allocated per block. |
compute_phi | pass(self) | Compute the immersed solids distance function (host). |
make_ib_maps | pass(self) | Build the ghost maps of the eikonal sweeps (#156 L2). |
destroy_common | pass(self) | Free common data. |
glm_lambda | pass(self) | Return the GLM bound of the local dt, c_h max sum_d 1/dx_d. |
initialize | pass(self) | Initialize the common data. |
log_dt_limit | pass(self) | Log which limit, hyperbolic or diffusive, sets dt. |
log_gravity_regime | pass(self) | Log the velocity gravity adds in a step (issue #73). |
log_self_gravity | pass(self) | Log the self-gravity regime (issue #81). |
poisson_iterations | pass(self) | FCG iterations of the last multigrid solve. |
wall_temperature_bound | pass(self) | Return the hottest isothermal wall temperature of the dt bound. |
null_freeze | pass(self) | Return the variable each null direction freezes. |
output_factors | pass(self) | Return the output factors of written variables. |
output_names | pass(self) | Return the names of every written variable. |
report_divb | pass(self) | Reduce and save the div(B) norms, apply the divb_tol monitor. |
report_glm_speed | pass(self) | Check c_h against the fastest wave (warning or stop). |
nonfinite_total | pass(self) | Sum the non-finite values count over the ranks. |
stop_nonfinite | pass(self) | Stop on a non-finite state, locating it on every rank. |
load_restart_files | pass(self) | Load restart files. |
save_restart_files | pass(self) | Save restart files. |
load_wm_filter | pass(self) | Load the wall-model input filter averages of a restart (issue #119). |
save_wm_filter | pass(self) | Save the wall-model input filter averages (issue #119). |
advance_inflow_df | pass(self) | Move the digital-filter inflow on by the step (issue #119, T3.7). |
advance_inflow_rr | pass(self) | Rebuild the recycling inflow's ghost rows from the committed state (issue #121, S5). |
save_wall_history | pass(self) | Save the wall-model history on its cadence (issue #119, T3.7). |
save_slices | pass(self) | Save the slices on their cadence. |
save_xh5f | pass(self) | Save fields in XH5F format. |
set_divb_seam | pass(self) | Set the seam faces flags of the div(B) history. |
set_glm_damping | pass(self) | Set the GLM damping once the grid exists. |
set_potential | pass(self) | Set the gravitational potential of the current grid. |
solve_potential | pass(self) | Solve the self-gravity potential of a host state. |
solve_potential_packed | pass(self) | Solve the self-gravity potential of a packed density. |
compute_sink_accelerations | pass(self) | Mesh gravity at the sinks (issue #94). |
deposit_sinks | pass(self) | Add the sinks' CIC mass to a packed density (issue #94). |
set_limiter_dt | pass(self) | The positivity limiter's forward-Euler step of a stage. |
step_sinks | pass(self) | Kick-drift-kick of the sinks, SELAH's Strang (#94, #134 D4). |
wrap_sinks | pass(self) | Wrap the sinks on periodic faces, refuse a sink outside (#94). |
sink_stencil | pass(self) | CIC stencil of a point: target points and weights (issue #94). |
sinks_dt_limit | pass(self) | Time step limit of the sinks (issue #94). |
accrete_sinks | pass(self) | Threshold accretion of the committed host state (issue #94). |
accrete_cells | pass(self) | Threshold accretion on gathered cells (issue #94). |
sink_accretion_cells | pass(self) | The cells within an accretion radius (issue #94). |
create_sinks | pass(self) | Sink creation, Federrath et al. 2010 (issue #94). |
merge_sinks | pass(self) | Merge bound, converging sinks (issue #94). |
sink_accretion_radius | pass(self) | Accretion radius of a point (issue #94). |
coupling_descriptor_forest | pass(self) | Return the realm coupling descriptor. |
set_wall_model_faces | pass(self) | Flag the block faces of the wall model. |
set_hybrid_faces | pass(self) | Flag the block faces the central flux must not read across. |
accumulate_seam_fluxes | pass(self) | Accumulate the weighted seam face fluxes of one stage. |
reflux_stage | pass(self) | The per-stage reflux (issue #81, P5c). |
flag_troubled_seam_cells | pass(self) | Flag the troubled seam face cells of one stage (#68 E1). |
add_dissipative_fluxes_dev | pass(self) | Add the dissipative face fluxes on the device (issue #65). |
apply_floors | pass(self) | Apply the MHD positivity floors of a stage. |
allocate_gpu | pass(self) | Allocate device data. |
check_glm_ch | pass(self) | Check the GLM c_h against the fastest wave. |
compute_conservation | pass(self) | Compute and save the conservation integrals. |
compute_divb_history | pass(self) | Compute and save the div(B) norms (MHD). |
compute_turbulence_history | pass(self) | Compute and save the turbulence history (issue #119). |
apply_forcing | pass(self) | Hold the bulk momentum of a channel (issue #119, T3.1). |
update_hybrid_sensor | pass(self) | Compute the sensor, single-valued on the ghost cells (issue #119, T2). |
overwrite_hybrid_fluxes | pass(self) | Central flux where the sensor allows it (issue #119, T2). |
update_wall_model_faces | pass(self) | Flag the block faces of the wall model (issue #119, T3.3). |
overwrite_wall_model_fluxes | pass(self) | The wall-face fluxes of the wall model (issue #119, T3.3). |
close_noslip_fluxes | pass(self) | Close the inviscid fluxes through no-slip wall faces (the #65 mass leak). |
update_hybrid_faces | pass(self) | Flag the block faces of the sensor (issue #119, T2.4). |
compute_mu_t | pass(self) | Compute the eddy viscosity of the model (issue #119). |
update_sgs_lambda | pass(self) | Update the time step limit of the eddy viscosity (issue #119). |
compute_dflux_norms | pass(self) | Compute the D_flux norms of the committed state (#68 A2). |
compute_q_aux | pass(self) | Compute the auxiliary variables. |
compute_gravity_correction | pass(self) | Compute the fourth-order gravity energy correction. |
refresh_equilibrium_residual | pass(self) | Recompute the equilibrium residual if stale. |
check_nonfinite | pass(self) | Stop on a non-finite committed state. |
sync_dual_energy | pass(self) | Synchronise the total energy and the entropy (issue #91). |
apply_cooling | pass(self) | Radiative cooling of the committed state (issue #93). |
refresh_sink_accelerations | pass(self) | The device potential (#94). |
cooling_time_min | pass(self) | Shortest cooling time of the committed state (issue #93). |
accrete_sinks_gpu | pass(self) | Threshold accretion of the committed device state (issue #94). |
copy_cpu_gpu | pass(self) | Copy state and topology from host to device. |
copy_gpu_cpu | pass(self) | Copy state from device to host. |
wm_filter_to_host | pass(self) | Copy the wall-model filter averages from the device to the host arrays (issue #119). |
wm_filter_to_device | pass(self) | Copy the host wall-model filter averages to the device (issue #119). |
inflow_df_to_device | pass(self) | Copy the digital-filter inflow ghost rows to the device (issue #119). |
inflow_rr_gather | pass(self) | Gather the recycling plane's cells from the device (issue #121, S5). |
inflow_rr_to_device | pass(self) | Copy the recycling inflow ghost rows to the device (issue #121, S5). |
wall_history_to_host | pass(self) | Copy the state to the host for the wall-model history (issue #119). |
copy_phi_gpu | pass(self) | Copy the immersed solids distance function to the device. |
refresh_potential | pass(self) | Set the gravitational potential and copy it to the device. |
copy_potential_gpu | pass(self) | Copy the gravitational potential to the device. |
solve_potential_gpu | pass(self) | Solve the self-gravity potential of a device state. |
destroy | pass(self) | Free device and host data. |
initialize_flume | pass(self) | Initialize the FNL backend. |
limit_positivity_dev | pass(self) | Apply the positivity limiter to the stage face fluxes. |
seam_ghosts_to_state | pass(self) | Copy the end_of_step seam ghosts into the stage state (#132). |
seam_lists | pass(self) | Host lists of the seam skin cells and faces (issue #50). |
seam_sync_blend_dev | pass(self) | Set the seam face fluxes with the seam factors (issue #50). |
seam_sync_factors_dev | pass(self) | Recompute the seam cells' factors (issue #50). |
seam_sync_fluxes_dev | pass(self) | Publish the donor states and the fine means (issue #50). |
seam_sync_theta_dev | pass(self) | Compute the seam factors (issue #50). |
save_residuals | pass(self) | Save residuals history. |
save_simulation_data | pass(self) | Save fields, restart and diagnostics on their cadence. |
set_boundary_conditions | pass(self) | Set boundary conditions on the device crown maps. |
build_bc_pass_rows | pass(self) | Group the BC crown map rows by pass (issue #90). |
update_ghost | pass(self) | Update ghost cells: local, MPI, boundary conditions. |
advance_one_step_forest | pass(self) | Advance one full step (fast path). |
after_topology_build_forest | pass(self) | Copy the forest-built seam and BC maps to the device. |
apply_reflux_to_stage_forest | pass(self) | Apply the reflux correction. |
begin_stage_forest | pass(self) | Begin an integrator stage (staged path). |
close_step_forest | pass(self) | Close a step (staged path). |
compute_local_dt_forest | pass(self) | Compute the local stability-limited time step. |
end_stage_forest | pass(self) | End an integrator stage (staged path). |
fill_seam_from_peer_forest | pass(self) | Fill inter-realm seam ghosts from a peer. |
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. |
finalize_forest | pass(self) | Finalize the realm. |
finalize_mpi_forest | pass(self) | Finalize the FNL MPI handler. |
initialize_process_context | pass(self) | Initialize the FNL and CPU MPI handlers, once per process. |
initialize_app_forest | pass(self) | Template hook: the backend. |
restart_state_forest | pass(self) | Template hook: the state from the restart files. |
amr_update_initial_forest | pass(self) | Template hook: one initial regrid. |
rebalance_initial_forest | pass(self) | Template hook: the static rebalance (issue #123). |
post_initial_state_forest | pass(self) | Template hook: device, ghosts, output files, t0 output. |
is_done_forest | pass(self) | Return true if the realm is done. |
open_step_forest | pass(self) | Open a step (staged path). |
post_step_forest | pass(self) | Post-step IO and diagnostics. |
regrid_forest | pass(self) | Regrid on the [amr] frequency cadence (issue #74). |
regrid_begin_forest | pass(self) | Regrid phase: begin (issue #110). |
regrid_mark_forest | pass(self) | Regrid phase: mark one sweep (issue #110). |
regrid_apply_forest | pass(self) | Regrid phase: adapt to the tree marks (issue #110). |
regrid_end_forest | pass(self) | Regrid phase: refresh the new state (issue #110). |
stages_per_step_forest | pass(self) | Return the integrator stages per step. |
flume_fnl_object%load_fdv_from_file
Load FDV config from file.
fortran
subroutine load_fdv_from_file(self, file_parameters)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The equation. | |
file_parameters | type(file_ini) | in | Simulation parameters ini file handler. |
Call graph
flume_fnl_object%initialize_forest
Initialize this realm, the library template (issue #80 P3): the sequence every application shares, its steps delegated to the *_forest hooks below.
fortran
call self%initialize_app_forest(filename, realms_number) ! parse, build the library and app objects, the backend
if (self%io%restart) then
call self%restart_state_forest ! the state from the restart files
else
do i=1, self%initial_amr_iterations_forest() ! the initial state, then a regrid on it, n times
call self%set_initial_state_forest
call self%amr_update_initial_forest
enddo
call self%rebalance_initial_forest ! [amr].(balance_static)
call self%set_initial_state_forest ! the initial state on the final grid
call self%adam%make_comm_local_maps_ghost_bc ! the maps of the final grid
call self%reset_time_forest
endif
call self%post_initial_state_forest ! device push, ghosts, t0 diagnostics, history filesInvoked by forest%initialize once per realm at startup, before the time loop; MPI and the device are up already (initialize_process_context). The forest sets self%realm_index = is BEFORE invoking it, so the hooks can read their forest position for per-realm IO filenames, log prefixes, etc. The template is non-overridable: an application implements the hooks, whose defaults error-stop, except restart_state_forest, which refuses [IO].(restart) = .true..
fortran
subroutine initialize_forest(self, filename, realms_number)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm. | |
filename | character(len=*) | in | Input parameters file name. | |
realms_number | integer(kind=I4P) | in | optional | Realm count in the forest. |
Call graph
flume_fnl_object%close_block_xh5f
Close XH5F file block.
fortran
subroutine close_block_xh5f(xh5f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
xh5f | type(xh5f_file_object) | inout | XH5F file handler. |
Call graph
flume_fnl_object%close_file_xh5f
Close XH5F file.
fortran
subroutine close_file_xh5f(xh5f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
xh5f | type(xh5f_file_object) | inout | XH5F file handler. |
Call graph
flume_fnl_object%open_block_xh5f
Open XH5F file block; length_scale multiplies the written block origin and spacing (output units of an application, e.g. FLUME [reference] output_units). The origin is the corner of the first stored cell: ngc_saved cells below the block's first interior cell, ngc_saved the ghost layers the caller writes (default all, ngc; 0 for the interior only, e.g. the restart snapshot, issue #109).
fortran
subroutine open_block_xh5f(self, xh5f, b, nijk, t, time, length_scale, ngc_saved)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The equation. | |
xh5f | type(xh5f_file_object) | inout | XH5F file handler. | |
b | integer(kind=I4P) | in | Block index. | |
nijk | integer(kind=I8P) | in | Blocks dimensions. | |
t | integer(kind=I4P) | in | optional | Time iteration. |
time | real(kind=R8P) | in | optional | Time. |
length_scale | real(kind=R8P) | in | optional | Scale of the written origin and spacing. |
ngc_saved | integer(kind=I4P) | in | optional | Ghost layers written (default ngc). |
Call graph
flume_fnl_object%open_file_xh5f
Open XH5F file.
fortran
subroutine open_file_xh5f(self, basename, xh5f, directory)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The equation. | |
basename | character(len=*) | in | Base name of output files. | |
xh5f | type(xh5f_file_object) | out | XH5F file handler. | |
directory | character(len=*) | in | optional | Directory name of output files. |
Call graph
flume_fnl_object%save_q_xh5f
Save ADAM in XH5F format.
fortran
subroutine save_q_xh5f(self, basename, q, q_name, directory, with_ghost, with_cell_morton, t, time)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The equation. | |
basename | character(len=*) | in | Base name of output files. | |
q | real(kind=R8P) | in | Q-vector variables [nv,ni,nj,nk,nb]. | |
q_name | character(len=*) | in | optional | Q-vector variables names [nv]. |
directory | character(len=*) | in | optional | Directory name of output files. |
with_ghost | logical | in | optional | Flag to save ghost cells. |
with_cell_morton | logical | in | optional | Flag to save Morton code also in cells. |
t | integer(kind=I4P) | in | optional | Time iteration. |
time | real(kind=R8P) | in | optional | Time. |
Call graph
flume_fnl_object%compute_curl_fd_extended
Compute curl of vector fields, div(q(ivar:ivar+2), using finite difference schemes.
fortran
subroutine compute_curl_fd_extended(self, hs, ivar, q, curl)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The equation. | |
hs | integer(kind=I4P) | in | FDV half stencil length. | |
ivar | integer(kind=I4P) | in | Start index of variable of q. | |
q | real(kind=R8P) | in | Field variables. | |
curl | real(kind=R8P) | inout | Curl. |
Call graph
flume_fnl_object%compute_gradient_fd_extended
Compute gradient of scalar variable q(ivar), finite difference schemes.
fortran
subroutine compute_gradient_fd_extended(self, hs, ivar, q, gradient)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The equation. | |
hs | integer(kind=I4P) | in | FDV half stencil length. | |
ivar | integer(kind=I4P) | in | Index of scalar variable of q. | |
q | real(kind=R8P) | in | Field variables. | |
gradient | real(kind=R8P) | inout | Gradient. |
Call graph
flume_fnl_object%amr_update
Do AMR update: amr%iters sweeps over the markers until the grid stabilizes (initialization-time only). The markers are the criteria of amr_marker_list (issue #110, P4.2), each marking with initial = .true. and followed by an AMR update; a criterion that acts at runtime regrids only (runtime_only: the Loehner marker, which also reads the ghosts of the physical faces the backends fill, and every registered criterion) is skipped here.
fortran
subroutine amr_update(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%initial_amr_iterations_forest
The passes of initial conditions + regrid before the final initial conditions, ic%amr_iterations.
Returns: integer(kind=I4P)
fortran
function initial_amr_iterations_forest(self) result(n)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | in | The equation. |
Call graph
flume_fnl_object%reset_time_forest
The time and the step counter of a run from scratch to zero.
fortran
subroutine reset_time_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%set_initial_state_forest
The initial conditions on the current grid (host) and the solids distance function.
fortran
subroutine set_initial_state_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%runtime_amr_forest
Return whether this realm regrids during the run: [amr] frequency > 0 (issue #74).
Returns: logical
fortran
function runtime_amr_forest(self) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | in | The equation. |
Call graph
flume_fnl_object%mark_by_geometry
Mark blocks to be refined by a primitive axis-aligned box (deterministic, solution-independent).
A block is flagged TO_BE_REFINED iff its centroid lies inside [box_emin, box_emax] and its refinement level is below target_level; every other block is left untouched (the marker is additive).
fortran
subroutine mark_by_geometry(self, box_emin, box_emax, target_level, do_init)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_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
flume_fnl_object%mark_by_gradient
Mark blocks by the gradient magnitude of a conservative (field = 1) or auxiliary (field = 2) variable.
CHASE semantics: the admissible cell spacing of a block is delta_fine where max |grad var| > tol, else delta_coarse; a block coarser than admissible is refined, a block whose parent (spacing doubled) would still be admissible is derefined, any other block is left untouched. The spacing of a block is chosen by delta_type (x, y, z or max). The gradient is centred, across the block faces too: a jump lying on an internal face (between two blocks, or periodic) is seen by the cells on both sides of it (issue #76: with interior-only differences each block saw a constant state up to the face, and Sod on [0, 1], its jump on a block face at every level, was never refined there). It is one-sided at the faces on the realm boundary (physical or seam), whose ghosts it never reads. The caller refreshes the ghosts of the internal faces: the initial AMR on the host (amr_update), the runtime regrids with the backend's full ghost update (regrid_forest).
fortran
subroutine mark_by_gradient(self, field, ivar, tol, delta_type, delta_fine, delta_coarse)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. | |
field | integer(kind=I4P) | in | Marker field: 1 conservative, 2 auxiliary variables. | |
ivar | integer(kind=I4P) | in | Variable index in the marker field. | |
tol | real(kind=R8P) | in | Gradient magnitude tolerance. | |
delta_type | character(len=*) | in | Block spacing criterion: x, y, z, max. | |
delta_fine | real(kind=R8P) | in | Admissible spacing where the gradient exceeds tol. | |
delta_coarse | real(kind=R8P) | in | Admissible spacing elsewhere. |
Call graph
flume_fnl_object%mark_by_solid
Mark blocks by the surface of immersed solid solid: CHASE semantics, with the refine/derefine rule of the gradient marker.
A block is crossed by the surface when its distance function (interior and ghost cells) changes sign; its admissible spacing is then delta_fine, delta_coarse otherwise. The distance function must be current (the caller computes it on the present grid). A run without solids, or a solid index out of range, is fatal (CHASE read phi unallocated in that case, issue #35 C-8).
fortran
subroutine mark_by_solid(self, solid, delta_type, delta_fine, delta_coarse)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. | |
solid | integer(kind=I4P) | in | Solid index. | |
delta_type | character(len=*) | in | Block spacing criterion: x, y, z, max. | |
delta_fine | real(kind=R8P) | in | Admissible spacing across the surface. | |
delta_coarse | real(kind=R8P) | in | Admissible spacing elsewhere. |
Call graph
flume_fnl_object%mark_by_lohner
Mark blocks by the Loehner (1987) estimator of a conservative (field = 1) or auxiliary (field = 2) variable (issue #74, D-M5-8).
The dimension-sum form of FLASH and PLUTO: on a cell, E = sqrt(sum_d N_d^2 / sum_d D_d^2) over the active directions, N_d = |u_+ - 2 u + u_-| and D_d = |u_+ - u| + |u - u_-| + epsilon (|u_+| + 2 |u| + |u_-|) + floor, with u_+- the neighbours along d. E lies in [0, 1], independent of the scale of u and of the cell size: about 0 where u is smooth on the grid, about 1 at a jump; epsilon keeps ripples small relative to u from triggering. On a variable that vanishes in quiet regions (the field outside a magnetic loop) that filter filters nothing: round-off noise is all there is, and it reads E ~ 1; floor, an absolute variation (default 0, the FLASH/PLUTO form), turns the variations well below it into noise (#74 P4). A block takes the largest E over its interior cells and buffer ghost layers (a feature at a neighbour's edge marks this block too): refined above refine_tol, derefined below derefine_tol, untouched between (the hysteresis band keeps a block near the threshold from flipping at every regrid). The caller refreshes the ghost cells of q.
fortran
subroutine mark_by_lohner(self, field, ivar, refine_tol, derefine_tol, epsilon, floor, buffer)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. | |
field | integer(kind=I4P) | in | Marker field: 1 conservative, 2 auxiliary variables. | |
ivar | integer(kind=I4P) | in | Variable index in the marker field. | |
refine_tol | real(kind=R8P) | in | Refine above this estimator value. | |
derefine_tol | real(kind=R8P) | in | Derefine below this estimator value. | |
epsilon | real(kind=R8P) | in | Noise filter, relative to the variable. | |
floor | real(kind=R8P) | in | Noise filter, absolute variation. | |
buffer | integer(kind=I4P) | in | Ghost layers the estimator reads. |
Call graph
flume_fnl_object%mark_by_jeans
Mark blocks by the resolution of the local Jeans length (issue #91; Truelove et al. 1997, ApJ 489, L179).
On a cell, lambda_J = sqrt(pi c_s^2 / (G rho)) with the thermal sound speed c_s^2 = gamma p / rho, and for a barotropic gas dP/drho (issue #100, D-M13-4: the piecewise polytrope's Gamma_k P / rho). Magnetic support is not counted, so an MHD run refines at least as early as the hydrodynamic criterion asks. A block takes the smallest lambda_J / h over its interior cells, h its spacing by delta_type: refined below jeans_cells (Truelove: at least 4), derefined above jeans_cells_derefine, untouched between (the hysteresis band of Federrath et al. 2010). Cell-local: it reads no ghost cell. refine_only (the initial AMR) never asks to derefine.
fortran
subroutine mark_by_jeans(self, jeans_cells, jeans_cells_derefine, delta_type, refine_only)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. | |
jeans_cells | real(kind=R8P) | in | Refine below this many cells per lambda_J. | |
jeans_cells_derefine | real(kind=R8P) | in | Derefine above this many cells per lambda_J. | |
delta_type | character(len=*) | in | Delta criterion of the block spacing. | |
refine_only | logical | in | optional | Never ask to derefine. |
Call graph
flume_fnl_object%mark_by_kolmogorov
Mark blocks by the local Kolmogorov resolution r = h / eta (issue #133, phase 2; kolmogorov_block_max).
On a cell eta = (nu^3 / eps)^(1/4), eps = 2 nu S_d:S_d with S_d the deviatoric strain rate, nu = mu(T) / rho by the viscosity law of the run (molecular: an SGS eddy viscosity is not counted), and h = (prod_d dx_d)^(1/n) over the n active axes (a null axis does not enter). A block takes the largest r over its interior cells: refined above refine_tol, derefined below derefine_tol, untouched between (0 < derefine_tol < refine_tol / 2, checked at load: r halves across a level). The velocity gradient is the gradient marker's (centred, across the internal block faces; one-sided at the faces on the realm boundary, whose ghosts it never reads). The caller refreshes the ghosts of the internal faces. refine_only (the initial AMR) never asks to derefine.
fortran
subroutine mark_by_kolmogorov(self, refine_tol, derefine_tol, refine_only)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. | |
refine_tol | real(kind=R8P) | in | Refine above this r. | |
derefine_tol | real(kind=R8P) | in | Derefine below this r. | |
refine_only | logical | in | optional | Never ask to derefine. |
Call graph
flume_fnl_object%mark_runtime
Combine the markers into the flags of a runtime regrid (issue #74, D-M5-8).
Each marker votes per block: refine, keep (untouched) or derefine. A block is refined when any marker asks for it, derefined only when every marker agrees, untouched otherwise; a block at the base level (iu_ref_levels, the uniform level of the initial grid) is never derefined. The geometric box votes refine inside the box below its target level, keep inside at the target level, derefine elsewhere (outside the box, or inside above the target): as a vote it must not pin the grid outside its box, as it would if "untouched" vetoed the other markers there. The initial AMR (amr_update) is unchanged: there the markers act one after the other. The caller refreshes the ghost cells of q (the Loehner marker and the solid marker read them).
fortran
subroutine mark_runtime(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%register_amr_criterion
Register a refinement criterion (issue #110, P4): [amr_marker_N] mode = 6, name = <criterion%name> selects it at runtime regrids. The realm keeps a pointer: the program owns the instance, which must have the TARGET attribute and outlive the simulation (a variable of the main program, or a SAVEd one; not a local of a procedure that returns before the run); a second criterion with the same name stops the run.
fortran
subroutine register_amr_criterion(self, criterion)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. | |
criterion | class(amr_criterion_object) | in | pointer | The criterion (a TARGET actual is pointed to). |
Call graph
flume_fnl_object%check_regridded_state
Stop on an inadmissible state after a runtime regrid (issue #74): density or pressure not positive on an interior cell. The conservative prolongation keeps every conserved variable in the range of its stencil, so the density stays positive, but the pressure is a nonlinear function of the conserved variables and a child of a cell next to a strong jump can lose it; the run is stopped here, at its cause, rather than later at a non-finite flux.
fortran
subroutine check_regridded_state(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%is_regrid_step
Return whether the step just closed is a runtime regrid step: [amr] frequency > 0 and the step count a multiple of it (issue #74). The step count is restored by a restart, so a restarted run regrids on the same steps.
Returns: logical
fortran
function is_regrid_step(self) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | in | The equation. |
Call graph
flume_fnl_object%accumulate_seam_skin
Route one seam face skin of block b, face fec, weighted by weight, to the forest's flux register.
Shared by the backends (the register is host-side): the CPU packs skin from its face fluxes, the FNL backend packs it on the device and copies it to the host. skin(v, c) is the face flux with the cell index c running over the two tangential axes, inner fastest (x faces: j, k; y faces: i, k; z faces: i, j), the register order. Coarse side (positive register index): the skin is the coarse face. Fine side (negative index): on an intra-realm AMR seam the skin is 2:1-restricted (2x2 average; 2x1 across the unrefined z of a quadtree, issue #46) into this block's quadrant of the coarse face, the quadrant offset precomputed by the forest from the Morton codes (maps%amr_seam_quadrant); on an inter-realm mirror seam (same resolution) it is accumulated unrestricted into the register faces it overlaps (maps%seam_overlap, issue #51: the blocks of the two realms need not line up; one full-skin overlap when they do).
FLUME weighs every stage by its SSP coefficient, weight = beta_s: the register then holds the flux of the whole step, sum_s beta_s F_s, exactly the flux the committed update q + dt sum_s beta_s dq_s used, and the end-of-step correction restores conservation to round-off (issue #35, P5; AMReX non-subcycled flux register).
fortran
subroutine accumulate_seam_skin(self, flux_register, b, fec, weight, skin)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | in | The equation. | |
flux_register | class(flux_register_object) | inout | Forest's flux register. | |
b | integer(kind=I4P) | in | Block index. | |
fec | integer(kind=I4P) | in | Face (1..6: -x, +x, -y, +y, -z, +z). | |
weight | real(kind=R8P) | in | Stage weight. | |
skin | real(kind=R8P) | in | Face skin (nv, inner_n*outer_n). |
Call graph
flume_fnl_object%add_seam_gravity_work
Add the gravity work of self-gravity across a 2:1 AMR seam to the energy row of a seam skin (issue #81, P5b), so that the end-of-step reflux makes E + W telescope exactly at the seam.
The potential sources give each cell 1/2 g F per face (add_potential_sources), g its own face gravity and F the face mass flux. The mass update moves A_f F_f across every fine sub-face f of a coarse face, which changes W by s A_f F_f (Phi_f - Phi_C) (s = +1 when the fine side lies at +axis of the coarse cell C), so exact E + W needs the seam's energy sources to sum to s sum_f A_f F_f (Phi_C - Phi_f); the two kernels give instead the multigrid's mean-flux gravity ((mean_f - Phi_C) / (1.5 h) on both sides). The difference rides on the register's energy entry, which the reflux turns into sgn (G_coarse - G_fine) / H in the coarse cell:
- coarse skin:
G_c = -s 1/2 g_c F_c H(takes the coarse cell's own seam source back); - fine skin:
G_f = -F_f (Phi_C - Phi_f) + s 1/2 g_f F_f h(the exact two-point work, less the fine cell's own source, which stays: the fine cells keep the consistent gravity). The fine side recoversPhi_Cfrom its ghost,Phi_C = mean_f - 1.5 (Phi_f - Phi_ghost)(the multigrid's ghost fill),mean_fthe mean of the fine skin cells of the coarse face. Every term is per stage, weighted with the fluxes, so the identity holds stage by stage. Exact only where the reflux corrects every seam cell (not under thetroubledreflux policy) and the positivity limiter does not act (its gravity energy correction, M7).
fortran
subroutine add_seam_gravity_work(self, flux_register, b, fec, skin)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | in | The equation. | |
flux_register | class(flux_register_object) | in | Forest's flux register. | |
b | integer(kind=I4P) | in | Block index. | |
fec | integer(kind=I4P) | in | Face (1..6: -x, +x, -y, +y, -z, +z). | |
skin | real(kind=R8P) | inout | Face skin (nv, inner_n*outer_n). |
Call graph
flume_fnl_object%allocate_common
Allocate common data.
fortran
subroutine allocate_common(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%compute_fields_number
Compute the block-sized fields FLUME 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): q, dq (2 nv), q_aux (nv_aux), the three face fluxes (3 nv, counted as full block fields) and the Runge-Kutta stages (the SELAH stepper's registers, stepper_stored_fields nv, its residual register included, #132), plus the positivity limiter's cell factors (nv, q-shaped for the ghost exchange), the fourth-order gravity energy correction (1, every run, issue #73 M7-G2a), the equilibrium residual of the well-balanced mode (nv, M7-G2b), the gravitational potential (1, issue #81) and the eddy viscosity (1, issue #119). Requires physics, numerics and turbulence initialized; parses [runge_kutta] into ts (its library parser).
fortran
subroutine compute_fields_number(self, file_parameters, fields_number)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_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
flume_fnl_object%compute_phi
Compute the distance function of the immersed solids on the host (a no-op without solids); the solids are static, so the backends compute it once per grid (initialization, restart, initial AMR). The ghost maps of the eikonal sweeps follow the distance function (make_ib_maps).
fortran
subroutine compute_phi(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%make_ib_maps
Build the ghost maps of the eikonal sweeps (#156 L2): the realm's ghost maps restricted to the ghost cells the sweeps read. A sweep updates only the interior cells inside a solid (phi > 0) from their six face neighbours (ib_object%evolve_eikonal and its FNL twin), so the only ghost values it reads lie in the ghost layer next to a solid cell on a block face. The exchanges before and between the sweeps fill those cells only; the main exchange after the sweeps fills every ghost. Collective. Rebuilt with phi, after every map change.
fortran
subroutine make_ib_maps(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%destroy_common
Free common data.
fortran
subroutine destroy_common(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%glm_lambda
Return the GLM bound of the local time step, c_h max_b sum_{d active} 1 / dx_d (issue #41, section 3.5): the (B_n, psi) waves travel at c_h along every active direction, the multi-dimensional form of dt <= CFL dx / c_h consistent with the fluid bound sum_d (|u_d| + c_{f,d}) / dx_d. Zero without GLM; local (the forest reduces dt).
Returns: real(kind=R8P)
fortran
function glm_lambda(self) result(lambda)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | in | The equation. |
Call graph
flume_fnl_object%initialize
Initialize the common data (issue #35, section 6.1, step 3).
fortran
subroutine initialize(self, filename, memory_avail, nv, fields_number, verbose, L0)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_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 | Unused: nv is decided by the physics. |
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 | Unused: FLUME is dimensional. |
Call graph
flume_fnl_object%log_dt_limit
Log, once per run (rank 0, all ranks reduce), whether the time step is limited by the hyperbolic or by the diffusive part of dt = CFL / max(lambda_hyp + lambda_dif) (issue #65, D-M4-3), with the minimum cell Reynolds number.
fortran
subroutine log_dt_limit(self, lambda_hyp, lambda_dif, re_cell_min)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | in | The equation. | |
lambda_hyp | real(kind=R8P) | in | Maximum of the hyperbolic part of this rank. | |
lambda_dif | real(kind=R8P) | in | Maximum of the diffusive part of this rank. | |
re_cell_min | real(kind=R8P) | in | Minimum cell Reynolds number of this rank. |
Call graph
flume_fnl_object%log_gravity_regime
Log once (rank 0, at the first step; every rank reduces) how stiff gravity is (issue #73, D-M7-6): |g| dt against the signal speed bound CFL h_min / dt (dt = CFL / lambda_max and lambda_max >= c_max / h_min), so the ratio |g| dt^2 / (CFL h_min) is at least the velocity gravity adds in a step over the fastest wave speed. No time step limit is imposed: a ratio near 1 or above says gravity, not the waves, should set dt.
fortran
subroutine log_gravity_regime(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | in | The equation. |
Call graph
flume_fnl_object%log_self_gravity
Log once, with log_gravity_regime, the self-gravity regime (issue #81): the free-fall time of the densest cell, t_ff = sqrt(3 pi / (32 G rho_max)), against dt (a warning above t_ff / 10: the collapse would be under-resolved in time), and the wall time of the last Poisson solve.
fortran
subroutine log_self_gravity(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | in | The equation. |
Call graph
flume_fnl_object%poisson_iterations
FCG iterations of the last multigrid solve (0 without the multigrid solver).
Returns: integer(kind=I4P)
fortran
function poisson_iterations(self) result(iterations)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | in | The equation. |
Call graph
flume_fnl_object%wall_temperature_bound
Return the hottest isothermal wall temperature that the diffusive time step bound must cover (issue #65, P2): 0 without isothermal walls, and with constant laws (the coefficients then do not depend on the temperature).
Attributes: pure
Returns: real(kind=R8P)
fortran
function wall_temperature_bound(self) result(t_wall)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | in | The equation. |
Call graph
flume_fnl_object%null_freeze
Return, per direction, the conservative variable whose residual a null direction freezes (0: none).
Euler: the momentum along the null direction (CHASE semantics, issue #35, section 3.4). MHD: none, the 1-D MHD Riemann problems evolve the transverse momentum and field through the fluxes of the active directions (issue #41, M2-P3). Host data passed to the model-independent flux difference: no model branch in the kernels.
Returns: integer(kind=I4P)
fortran
function null_freeze(self) result(freeze)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | in | The equation. |
Call graph
flume_fnl_object%output_factors
Return the output factors of written variables (1 with code output units, issue #49 N2c).
Returns: real(kind=R8P)
fortran
function output_factors(self, names) result(factor)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | in | The equation. | |
names | type(string) | in | Variables names. |
Call graph
flume_fnl_object%output_names
Return the names of every variable FLUME may write: conservative, residuals, auxiliary and, for MHD, derived.
Returns: type(string)
fortran
function output_names(self) result(names)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | in | The equation. |
Call graph
flume_fnl_object%report_divb
Reduce the div(B) norms of this rank over all ranks, save the div(B) history row and apply the monitor (issue #41, D-10; on the normalised D_flux since issue #68 G1): max h|D_flux| / max|B| > [mhd].(divb_tol) (> 0) is fatal with divb_error, otherwise a warning logged by rank 0 each time the measure exceeds the largest one reported so far. The D_flux norms come with [diagnostics] divb_flux, which divb_tol > 0 requires (check_divb_flux).
fortran
subroutine report_divb(self, norms)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. | |
norms | real(kind=R8P) | in | This rank's max|div B|, sum |div B| dV, seam-local max|div B|; with divb_flux (issue #68 A2) then max|D_flux|, sum |D_flux| dV, seam-local max|D_flux|, max h|D_flux|, max|B|. |
Call graph
flume_fnl_object%report_glm_speed
Check the GLM cleaning speed against the fastest wave (issue #41, section 3.5, D-9): max(|u_d| + c_{f,d}) > c_h is fatal with [mhd].(glm_ch_check) = error, otherwise a warning logged by rank 0 each time the speed exceeds the largest one reported so far (GLM stays stable, dt includes c_h, but the cleaning is slower than the fastest wave).
fortran
subroutine report_glm_speed(self, speed_max)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. | |
speed_max | real(kind=R8P) | in | Fastest wave speed of this rank. |
Call graph
flume_fnl_object%nonfinite_total
Return the number of non-finite values of the committed state over every rank (issue #45).
Returns: integer(kind=I8P)
fortran
function nonfinite_total(self, n_local) result(n_total)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | in | The equation. | |
n_local | integer(kind=I8P) | in | Non-finite values number of this rank. |
Call graph
flume_fnl_object%stop_nonfinite
Stop the run on a non-finite (NaN or infinite) committed state (issue #45), reporting on every rank the first non-finite value of the host q (the caller has made it current): block Morton code, cell centre, variable. Every rank calls it after the reduction, so the stop is collective (the first error_stop aborts the others, #43).
fortran
subroutine stop_nonfinite(self, n_total)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | in | The equation. | |
n_total | integer(kind=I8P) | in | Non-finite values number of all ranks. |
Call graph
flume_fnl_object%load_restart_files
Load restart files.
fortran
subroutine load_restart_files(self, t, time)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. | |
t | integer(kind=I4P) | out | Time iteration. | |
time | real(kind=R8P) | out | Time. |
Call graph
flume_fnl_object%save_restart_files
Save restart files.
fortran
subroutine save_restart_files(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%load_wm_filter
Load the wall-model input filter averages of this rank from <basename>-proc<rank>.wmf (issue #119), so a restart continues the run bit for bit. The blocks must be the restart's own, in the same order (checked by their Morton codes: fatal otherwise). A checkpoint without the file (written before the averages were saved, or by a run without the filter) restarts the averages from the next sample.
fortran
subroutine load_wm_filter(self, basename)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. | |
basename | character(len=*) | in | Restart files basename. |
Call graph
flume_fnl_object%save_wm_filter
Save the wall-model input filter averages of this rank to <basename>-proc<rank>.wmf (issue #119): every rank writes its file, with zero blocks if it owns none (as save_blocks), the Morton code of each block before its averages.
fortran
subroutine save_wm_filter(self, basename)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. | |
basename | character(len=*) | in | Restart files basename. |
Call graph
flume_fnl_object%advance_inflow_df
Move the digital-filter inflow on by the step time%dt (issue #119, T3.7): once per step, before the first stage, on every rank alike (the forest's step is global); then the backend refreshes its ghost rows.
fortran
subroutine advance_inflow_df(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%advance_inflow_rr
Rebuild the recycling inflow's plane from the committed state (issue #121, S5): once per step, before the first stage, on every rank alike (the plane's allreduce is collective); the backend gathers this rank's plane cells. The ghost rows are listed from the plane where the backend lists the digital filter's (the CPU at every boundary fill, FNL when it copies them to the device), so they follow the map. Nothing without the face.
fortran
subroutine advance_inflow_rr(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%save_wall_history
Save the wall-model history on its cadence ([diagnostics] wall_history_save, issue #119, T3.7): for every modelled face, the wall shear stress along wall_history_axis and the wall heat flux (k dT/dy at the wall, positive when the gas is hotter), area-averaged over the face cells in wall_history_bins bins along that axis, to <output_basename>-wall_<face>_history.dat (code units; it, time, the bins' stress, then their heat flux). The model is evaluated on the committed state at its sample, as overwrite_wall_fluxes takes it without the input filter: with wall_model_filter the stress applied differs from this one by the filter's lag. The same host code on every backend.
fortran
subroutine save_wall_history(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%save_slices
Save the slices (library slices_object, [slices] / [slice_N]) of the conservative variables on their cadence; the caller has refreshed the ghost cells of the host q (the interpolation stencils read them).
fortran
subroutine save_slices(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%save_xh5f
Save fields in XH5F format: q always, dq when [IO].(save_residual_fields), the auxiliary variables (computed from the saved q, ghost cells included) when [IO].(save_auxiliary_fields). With [reference] output_units = dimensional every field, the grid and the time are multiplied by their output factors (a scaled copy of each block, the state itself is untouched).
fortran
subroutine save_xh5f(self, output_basename, with_ghost)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_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
flume_fnl_object%set_divb_seam
Set the seam faces flags of the div(B) history (issue #41, D-10): a block face is a seam face when the forest registered it in the flux register (a 2:1 AMR or inter-realm seam, inter_realm_face_register_index /= 0). Sized by the block capacity nb, as every block-indexed device array: on a rank that owns no block (blocks_number = 0) a blocks_number-sized array is empty and its device copy (FNL) a zero-byte allocation, which the device allocator returns as a null pointer and FUNDAL reports as failed (issue #82). The rows past blocks_number stay 0 and are never read.
fortran
subroutine set_divb_seam(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%set_glm_damping
Set the GLM damping once the grid exists (issue #41, section 3.5): the minimum cell spacing of the realm over the active directions (MPI-reduced) is the min-cell damping length. With runtime regridding ([amr] frequency > 0, issue #74) it is the spacing of the finest level allowed ([amr] max_level), fixed for the run whatever the grid holds. A no-op without GLM.
fortran
subroutine set_glm_damping(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%set_potential
Set the gravitational potential of the current grid, ghost cells included (issue #81, M8-P1). With [gravity] potential = linear it is Phi = -g . x at the cell centres, the constant field written as a potential; with self_gravity (M8-P3) the Poisson solver is set up on the current grid and Phi is solved from the host state q: on a uniform grid the FFT solver (periodic or isolated), on an AMR grid (leaves at more than one level, P5b) the multigrid solver, its coarsest level solved by the FFT solver of the backend, periodic or isolated (the symmetric James step, issue #87: every leaf on the domain boundary at the coarsest level, which a regrid that refines a boundary block breaks, fatal in the solver's initialize, D-87-4); without a potential the array is a one-cell placeholder (the kernels take it and do not read it). Sized by the block capacity nb, as the other block arrays; call it after the initial grid and after every regrid.
fortran
subroutine set_potential(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%solve_potential
Solve the self-gravity potential of the host state q (issue #81, M8-P3): L_h Phi = 4 pi G (rho - mean rho), every ghost layer filled (the FFT solver's wrap, or the multigrid's ghost fill on AMR), the wall time kept in poisson_wall; optionally the energy sum_cells rho Phi dV (every rank). The FNL backend solves from the device state with solve_potential_gpu, through solve_potential_packed. Packed density. Counters.
fortran
subroutine solve_potential(self, q, energy)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. | |
q | real(kind=R8P) | in | State. | |
energy | real(kind=R8P) | out | optional | sum_cells rho Phi dV. |
Call graph
flume_fnl_object%solve_potential_packed
Solve the self-gravity potential from the packed interior density of the active blocks (block-major, i fastest), into phi_grav with every ghost filled (issue #81): the FNL backend's host step. Optionally the energy sum_cells rho Phi dV (every rank).
fortran
subroutine solve_potential_packed(self, buf, energy)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. | |
buf | real(kind=R8P) | in | Packed density. | |
energy | real(kind=R8P) | out | optional | sum_cells rho Phi dV. |
Call graph
flume_fnl_object%compute_sink_accelerations
Compute the mesh gravity at every sink (issue #94): the centred difference of the host potential phi_grav at the cells of the sink's CIC stencil, interpolated with the deposit's weights (the same CIC pair, Hockney & Eastwood: no self-force on a uniform grid); each rank sums its own cells, an MPI reduction completes the list.
fortran
subroutine compute_sink_accelerations(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%deposit_sinks
Add the sinks' mass to a packed density of the local blocks (issue #94, D-M12-2): each sink spreads its mass over its CIC stencil; the rank that owns a target cell adds m w / dV there (a null direction spreads it evenly over its cells). Every rank walks every sink and keeps its own targets, so the total deposited mass is the sinks' mass.
fortran
subroutine deposit_sinks(self, buf)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. | |
buf | real(kind=R8P) | inout | Packed density, block-major, i fastest. |
Call graph
flume_fnl_object%set_limiter_dt
Set the forward-Euler step the positivity limiter makes admissible (#134 D4): stage s of the step takes its residual into steps of at most stage_euler_fraction(s) dt (SELAH, from the scheme's Shu-Osher form: f_s = max_i beta_is / alpha_is), so a stage state plus that step of its residual kept admissible keeps every later stage and the step admissible; f_s = 1 for every stage of SSP-11/22/33, 0.39 to 0.66 for SSP-54. Without a stage (a residual outside the step: the equilibrium residual, the D_flux diagnostic) the step dt.
fortran
subroutine set_limiter_dt(self, s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. | |
s | integer(kind=I4P) | in | optional | Stage. |
Call graph
flume_fnl_object%step_sinks
Advance the sinks over dt by kick-drift-kick (issue #94) through SELAH (#134 D4): the stepper's Strang splitting of the velocities (partition 1, the kick v' = a) and the positions (partition 2, the drift x' = v), each an exact sub-flow, so the composition is Stoermer-Verlet with SELAH's fractions (1/2, 1, 1/2) and SELAH's update. A kick takes the accelerations of the last computation; after a drift they are recomputed at the new positions (refresh_sink_accelerations, the potential re-solved) before the next kick. A direction the grid does not have does not drift (its residual is 0); after a drift a periodic direction wraps and a sink outside a closed domain is fatal (wrap_sinks). The list is replicated on every rank and short: it is packed into a SELAH field p(6, n) (positions, velocities; device memory in a device build) and unpacked after every flow.
fortran
subroutine step_sinks(self, dt)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. | |
dt | real(kind=R8P) | in | Time step of the flow. |
Call graph
flume_fnl_object%wrap_sinks
Bring a sink that left the domain through a periodic direction back in it; a sink outside a closed domain is fatal (no outflow for sinks, issue #94).
fortran
subroutine wrap_sinks(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%sink_stencil
Return the CIC stencil of a point (issue #94): up to 8 target points (cell centres of the level of the block that holds the point) and their weights, and the cell spacing there. Computed from the replicated tree, so every rank obtains the same stencil; a null direction takes the point itself with weight 1, a periodic one wraps, a closed one clamps the targets to the first interior centre (the weight stays in the domain: the deposit conserves mass).
fortran
subroutine sink_stencil(self, point, npt, pts, w, h)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. | |
point | real(kind=R8P) | in | Point. | |
npt | integer(kind=I4P) | out | Target points number. | |
pts | real(kind=R8P) | out | Target points. | |
w | real(kind=R8P) | out | Weights. | |
h | real(kind=R8P) | out | Cell spacing at the point. |
Call graph
flume_fnl_object%sinks_dt_limit
Return the time step limit of the sinks (issue #94): a sink moves at most half a cell of its level per step, and the gas a cell away, pulled by a = G m / h^2 (the mesh force peaks at about a cell), at most half a cell from rest, dt <= 0.5 sqrt(h / a) = 0.5 sqrt(h^3 / (G m)) (the acceleration limit of Federrath et al. 2010: a cold dense medium has a CFL step far longer than the fall onto a sink, and the self-gravity source is not limited by the CFL condition). huge without sinks. The list is replicated: every rank returns the same limit.
Returns: real(kind=R8P)
fortran
function sinks_dt_limit(self) result(dt)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%accrete_sinks
Threshold accretion of the committed host state (issue #94, D-M12-4): the cells within an accretion radius of a sink (sink_accretion_cells) are gathered from q, accreted (accrete_cells) and written back. The FNL backend does the same with its device state (accrete_sinks_gpu), so both run the same arithmetic.
fortran
subroutine accrete_sinks(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%accrete_cells
Threshold accretion on gathered cells (issue #94, D-M12-4; Federrath et al. 2010, section 2.3). A cell within the accretion radius of a sink gives up the mass above rho_thr = pi c_s^2 / (4 G r_acc^2) (c_s^2 = dP/drho of the cell) if that gas is bound to the sink and falls in (0.5 |u - v_s|^2 - G m_s / r < 0, (u - v_s) . (x - x_s) < 0); the cell that holds the sink, and every cell of a sink formed this step, are accreted without the checks. A cell within several radii gives its gas to the most bound sink. The cell keeps its specific values: every conservative variable is scaled by rho_thr / rho (velocity, specific energy and passive scalars unchanged), the dual-energy entropy rebuilt from the scaled energy. Each sink gains the mass and the momentum given up and moves to the centre of mass, from MPI-reduced sums: mass and momentum are conserved exactly. A sink formed this step that accreted nothing is removed.
fortran
subroutine accrete_cells(self, cells, values)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. | |
cells | integer(kind=I4P) | in | Cells (i, j, k, b) [4, n]. | |
values | real(kind=R8P) | inout | Their conservative variables [nv, n]. |
Call graph
flume_fnl_object%sink_accretion_cells
Return the interior cells of this rank within an accretion radius of some sink, blocks then k, j, i (issue #94): the cells accrete_cells reads.
fortran
subroutine sink_accretion_cells(self, cells)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. | |
cells | integer(kind=I4P) | out | allocatable | Cells (i, j, k, b) [4, n]. |
Call graph
flume_fnl_object%create_sinks
Form sinks from the committed host state (issue #94, D-M12-3; Federrath et al. 2010, section 2.2), on cells of the finest level present (with runtime regridding, of the finest level allowed): the density above the threshold of the accretion radius, no sink within that radius, and on the control volume (the cells within the radius, read through the ghost cells: accretion_radius_cells <= ngc) a minimum of the potential at the cell (ties allowed), a flow converging along every principal axis (the symmetric velocity gradient negative definite, Sylvester's criterion), Jeans instability (|E_grav| > 2 E_th) and boundedness (E_grav + E_th + E_kin < 0, the kinetic energy relative to the centre of mass), E_grav summed over the pairs of cells. The candidates of every rank are gathered and taken deepest potential first, one per accretion radius, so every rank forms the same sinks; a new sink has no mass and takes the gas above the threshold at its first accretion (accrete_sinks, unchecked). The host ghost cells of q and the potential must be current.
fortran
subroutine create_sinks(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%merge_sinks
Merge two sinks within an accretion radius that are bound and converging (0.5 mu |dv|^2 - G m1 m2 / d < 0, dv . dx < 0; Federrath et al. 2010): the pair becomes one sink at its centre of mass with its mass and momentum (issue #94). The list is replicated: every rank merges the same pairs.
fortran
subroutine merge_sinks(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%sink_accretion_radius
Return the accretion radius at a point: accretion_radius_cells cells of the level of the block that holds it (the smallest active spacing), the same on every rank (issue #94). With runtime regridding ([amr] frequency > 0) it is in cells of the finest level allowed ([amr] max_level), fixed for the run (Federrath et al. 2010, section 2.1): the sinks form there only (create_sinks) and their neighbourhood stays there (mark_runtime).
Returns: real(kind=R8P)
fortran
function sink_accretion_radius(self, point) result(r_acc)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. | |
point | real(kind=R8P) | in | Point. |
Call graph
flume_fnl_object%coupling_descriptor_forest
Return the realm coupling descriptor checked by the forest for stage-coincident admissibility.
fortran
subroutine coupling_descriptor_forest(self, scheme_time, rk_scheme, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | in | The equation. | |
scheme_time | character(len=:) | out | allocatable | Time-integration family tag. |
rk_scheme | character(len=:) | out | allocatable | Within-family scheme tag. |
nv | integer(kind=I4P) | out | Number of conserved variables on this realm. |
Call graph
flume_fnl_object%set_wall_model_faces
Flag the block faces on a wall-modelled domain face; at the start and after each step, so after a regrid (T3.6). Sized by the block capacity.
fortran
subroutine set_wall_model_faces(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
flume_fnl_object%set_hybrid_faces
Flag the block faces whose ghost cells are not a same-level copy (issue #119, T2.4): a 2:1 seam, a physical face, a forest seam. The central stencil must not read them. A flag acts along the normal of its face only: a seam along y must not change a flux along x, or the two blocks of an x interface could disagree on its one flux. hybrid_has_faces: some block in the realm has one, so that the sensor is exchanged, its ghost cells then exact copies (a ghost computed locally reads edge ghosts near a seam, which two blocks fill differently). Sized by the block capacity, as divb_seam.
fortran
subroutine set_hybrid_faces(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_common_object) | inout | The equation. |
Call graph
Subroutines
accumulate_seam_fluxes
Accumulate the seam face fluxes of stage s, weighted by its SSP coefficient, into the forest's flux register.
The register is host-side: the skins of all the seam faces of the rank are packed on the device in one launch and copied to the host in one transfer, then each is routed by the shared accumulate_seam_skin, as on the CPU.
fortran
subroutine accumulate_seam_fluxes(self, s, flux_register, weight, with_gravity_work)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
s | integer(kind=I4P) | in | Runge-Kutta stage. | |
flux_register | class(flux_register_object) | inout | Forest's flux register. | |
weight | real(kind=R8P) | in | optional | Weight replacing beta(s) (D_flux, #68 A2). |
with_gravity_work | logical | in | optional | Add the seam gravity work (default: without weight; issue #81). |
Call graph
flag_troubled_seam_cells
Flag the troubled seam face cells of one stage for the reflux policy troubled (issue #68 E1b), the FNL twin of the CPU flagging: the 6 cells across every owned register face cell (the coarse skin cell, two inside it, three ghosts outside) are gathered from q_aux_gpu to the host (density, velocity, pressure), where the same seam_weno5_sensor and the limiter's host seam factors (issue #50) flag them. Seam cells only: a small gather.
fortran
subroutine flag_troubled_seam_cells(self, flux_register)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
flux_register | class(flux_register_object) | inout | Forest's flux register. |
Call graph
add_dissipative_fluxes_dev
Add the dissipative face fluxes of the active directions to the inviscid ones (issue #65), from the auxiliary variables of the stage, on the device: the viscous and heat fluxes when a viscosity or a conductivity is on, the Ohmic ones (MHD) when the resistivity is; the kernel of the order is selected here, never inside the loops.
fortran
subroutine add_dissipative_fluxes_dev(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
apply_floors
Apply the MHD positivity floors to the interior of a stage state, before its ghost exchange (issue #41, 3.8).
Euler has no floors (return before any work). MHD: the floored cells of the stage are logged by rank 0 when any; a non-positive density or pressure with the floors disabled (both zero) is fatal, reported with the global minimum density and pressure.
fortran
subroutine apply_floors(self, q_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
q_gpu | real(kind=R8P) | inout | Conservative variables. |
Call graph
allocate_gpu
Allocate device data (every dev_alloc checked) and the host staging buffer.
fortran
subroutine allocate_gpu(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
check_nonfinite
Stop the run when the committed state holds a non-finite (NaN or infinite) value (issue #45): a run could otherwise finish with NaN fields and exit 0. One device pass over the interior cells, the model selected outside the kernels; the state is copied to the host only to locate a failure.
fortran
subroutine check_nonfinite(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
check_glm_ch
Check the GLM cleaning speed against the fastest wave of the committed state (issue #41, section 3.5); a no-op without GLM.
fortran
subroutine check_glm_ch(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
compute_conservation
Compute the volume integrals of the conservative variables on the device and save them on their cadence; with self-gravity (issue #81) the row gains W = 1/2 sum rho Phi dV and E + W, Phi solved from the committed state.
fortran
subroutine compute_conservation(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
apply_forcing
Hold the bulk momentum on the committed state, once per step (see adam_flume_forcing_object).
fortran
subroutine apply_forcing(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
update_hybrid_sensor
Compute the sensor; exchanged where the realm has flagged faces, its ghost cells then exact copies.
fortran
subroutine update_hybrid_sensor(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
overwrite_hybrid_fluxes
Compute the sensor and replace the WENO flux by the central one where it allows it (issue #119, T2).
fortran
subroutine overwrite_hybrid_fluxes(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
update_wall_model_faces
Flag the block faces of the wall model (issue #119, T3.3), at the start and after each step, so after a regrid.
fortran
subroutine update_wall_model_faces(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
close_noslip_fluxes
Zero the inviscid fluxes through no-slip wall faces but the normal momentum, before the dissipative ones are added: the wall is impermeable.
fortran
subroutine close_noslip_fluxes(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
overwrite_wall_model_fluxes
The wall-face fluxes of the wall model, after every other dissipative flux (issue #119, T3.3).
fortran
subroutine overwrite_wall_model_fluxes(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
update_hybrid_faces
Flag the block faces for the sensor (issue #119, T2.4), at the start and after each step, so after any regrid.
fortran
subroutine update_hybrid_faces(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
compute_mu_t
Compute the eddy viscosity from the auxiliary variables, ghost cells included in them (issue #119, T1): the kernel of the model is selected here, never inside the loops.
fortran
subroutine compute_mu_t(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
update_sgs_lambda
Update the local time step limit of the eddy viscosity from the committed state (issue #119, T1): compute_local_dt_forest cannot refresh the ghost cells, and adds this limit to its own, which over-estimates the sum of the two per cell.
fortran
subroutine update_sgs_lambda(self, realm)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
realm | type(realm_pointer) | inout | target, optional | Sibling realms. |
Call graph
compute_turbulence_history
Compute and save the turbulence history of the committed state on its cadence (issue #119, T0.1): the ghost cells are refreshed first and, with sibling realms, the inter-realm seam ghosts are refilled from the peers, as for the div(B) history; the auxiliary variables are recomputed from them.
fortran
subroutine compute_turbulence_history(self, realm)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
realm | type(realm_pointer) | inout | target, optional | Sibling realms. |
Call graph
compute_divb_history
Compute and save the div(B) norms of the committed state on the diagnostics cadence (issue #41, D-10); a no-op for Euler. The ghost cells are refreshed first and, with sibling realms, the inter-realm seam ghosts are refilled from the peers (update_ghost does not fill them, issue #31): the stencils of the seam-local cells read them. The seam faces flags are rebuilt and copied to the device at every call (6 nb integers): at step 0 the forest may not have registered the seams yet.
fortran
subroutine compute_divb_history(self, realm)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
realm | type(realm_pointer) | inout | target, optional | Sibling realms. |
Call graph
compute_dflux_norms
Compute the D_flux norms of the committed state (issue #68 A2), the device twin of the CPU procedure: the committed state is copied into the idle first RK stage buffer and its residual evaluated into the second, the seam face fluxes accumulated with weight 1 into the realm's copy of the forest's flux register (host side) and completed across the ranks; the reflux correction of the coarse skin cells of the intra-realm 2:1 faces this rank owns is built on the host over the blocks in use and copied to the device, where compute_dflux_norms_dev reduces the norms. The caller has refreshed the ghost cells of q_gpu and copied the seam faces flags to the device.
fortran
subroutine compute_dflux_norms(self, norms)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
norms | real(kind=R8P) | out | The five norms of this rank. |
Call graph
compute_q_aux
Compute the auxiliary variables on the device, ghost cells included.
fortran
subroutine compute_q_aux(self, q_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
q_gpu | real(kind=R8P) | in | Conservative variables. |
Call graph
copy_cpu_gpu
Copy state and topology (coordinates, maps) from host to device.
bounded (the runtime regrid, issue #75) copies the state of the blocks in use only: the device blocks beyond blocks_number hold nothing the scheme reads. Otherwise the whole block capacity nb is copied (initialization: it also gives the unused device blocks finite values).
fortran
subroutine copy_cpu_gpu(self, verbose, bounded)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
verbose | logical | in | optional | Trigger verbose output. |
bounded | logical | in | optional | Copy the blocks in use only. |
Call graph
wm_filter_to_host
Copy the wall-model filter averages from the device (b, i, j, k, v) to the host arrays (v, i, j, k, b) of the checkpoint (issue #119): a whole-array copy into a host buffer of the device shape (no staging buffer of another extent, issue #31), transposed on the host.
fortran
subroutine wm_filter_to_host(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
wm_filter_to_device
Copy the host wall-model filter averages (v, i, j, k, b) to the device (b, i, j, k, v) (issue #119): transposed on the host into a buffer of the device shape, then a whole-array copy.
fortran
subroutine wm_filter_to_device(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
copy_gpu_cpu
Copy state and residuals from device to host, the blocks in use only (issue #75: the outputs, the restart files and the non-finite report read nothing beyond blocks_number).
fortran
subroutine copy_gpu_cpu(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
copy_phi_gpu
Copy the immersed solids distance function (computed on the host, the solids are static) to the device, transposed from (s, i, j, k, b) to (b, i, j, k, s); the staging buffer has the extent of the device array (issue #31). bounded (the runtime regrid, issue #75) copies the blocks in use only.
fortran
subroutine copy_phi_gpu(self, bounded)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
bounded | logical | in | optional | Copy the blocks in use only. |
Call graph
refresh_potential
Set the gravitational potential of the current grid on the host (set_potential, issue #81) and copy it to the device, transposed from (i, j, k, b) to (b, i, j, k, 1); the device array is reallocated to the host extent (the block capacity may change at a regrid). Without a potential both are one-element placeholders, never zero bytes (issue #82). Call it after the state is on the device and after every regrid.
fortran
subroutine refresh_potential(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
copy_potential_gpu
Copy the host gravitational potential to the device, transposed from (i, j, k, b) to (b, i, j, k, 1); the device array is reallocated to the host extent.
fortran
subroutine copy_potential_gpu(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
solve_potential_gpu
Solve the self-gravity potential of the device state q_gpu (issue #81, M8-P3): a device kernel packs the interior density, which comes to the host and goes to the library solver (solve_potential_packed, FLAIL). On a uniform grid the solver is the distributed slab FFT on each rank's GPU (cuFFT, transposes by GPU-aware MPI_ALLTOALLV, #84 E5d); on an AMR grid the multigrid's FCG iteration and V-cycle run on the device, its right-hand side, coarsest level (cuFFT), James step and ghost-fill placement through the host (#84 E6a). The potential, every ghost layer filled, comes back to phi_grav and, for the active blocks only, to the device (unpack_potential_dev). Optionally the energy sum_cells rho Phi dV (every rank). The density and the potential cross the host every stage (the slab FFT gathers nothing to rank 0 since #84 E5d).
Only the active blocks cross the bus: phi_grav is sized to the block capacity (23270 blocks against 16 in use on an A30 at 32^2), and copying it whole every stage cost 0.73 s per solve, 99.6% of the solve.
fortran
subroutine solve_potential_gpu(self, q_gpu, energy)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
q_gpu | real(kind=R8P) | in | Device state (b, i, j, k, v). | |
energy | real(kind=R8P) | out | optional | sum_cells rho Phi dV. |
Call graph
destroy
Free device and host data: own device buffers, the FNL helpers (library teardown) and the common data.
fortran
subroutine destroy(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
initialize_flume
Initialize the FNL backend: MPI and device (once per process), device budget, common data, FNL helpers, device data, dispatch.
fortran
subroutine initialize_flume(self, filename, realms_number)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | target | The equation. |
filename | character(len=*) | in | Input file name. | |
realms_number | integer(kind=I4P) | in | optional | Realm count; divides the device budget. |
Call graph
limit_positivity_dev
Apply the positivity limiter to the device face fluxes of the stage (issue #47, D-9; device twin of the CPU limit_positivity): the model's factors kernel, the ghost exchange of the factors on the device (intra-realm copies and GPU-direct MPI only: a physical-boundary ghost keeps the factor 1 it was allocated with), the blending of the active directions; the counters are reduced over the ranks and logged. With 2:1 AMR seams the seam flux is synchronised as on the CPU (issue #50, adam_flume_seam_sync_object): the seam passes run on the host over the seam cells, fed by device gathers, and scatter their factors and face fluxes back.
fortran
subroutine limit_positivity_dev(self, q_gpu, flux_register, s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
q_gpu | real(kind=R8P) | in | Conservative variables of the stage. | |
flux_register | class(flux_register_object) | in | optional | Forest's flux register. |
s | integer(kind=I4P) | in | optional | Stage (absent: the step dt). |
Call graph
seam_lists
Host lists of this rank's seam skin cells (issue #50): coarse (or fine) selects the coarse (fine) seam faces; each entry has its interior cell (i, j, k, b), its face (axis, i, j, k, b) in the flux arrays' indexing and its skin destination (cdst: skin cell of the coarse skins; fdst: compact fine store, fcc: the coarse skin cell covering it, fw: its weight in the coarse mean, 1/4, or 1/2 along the unrefined z of a quadtree, issue #46). The order is block, face, skin cell, as on the CPU.
fortran
subroutine seam_lists(self, coarse, ccell, cface, cdst, fine, fcell, fface, fdst, fcc, fw)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | in | The equation. | |
coarse | logical | in | Lists to build. | |
ccell | integer(kind=I4P) | out | allocatable | Coarse cells [4, n], faces [5, n]. |
cface | integer(kind=I4P) | out | allocatable | Coarse cells [4, n], faces [5, n]. |
cdst | integer(kind=I4P) | out | allocatable | Coarse skin destinations. |
fine | logical | in | Lists to build. | |
fcell | integer(kind=I4P) | out | allocatable | Fine cells [4, n], faces [5, n]. |
fface | integer(kind=I4P) | out | allocatable | Fine cells [4, n], faces [5, n]. |
fdst | integer(kind=I4P) | out | allocatable | Fine store slots, covering coarse skin cells. |
fcc | integer(kind=I4P) | out | allocatable | Fine store slots, covering coarse skin cells. |
fw | real(kind=R8P) | out | allocatable, optional | Fine weights in the coarse means. |
Call graph
seam_sync_fluxes_dev
Seam synchronisation, first phase (issue #50; host twin of the CPU seam_sync_fluxes, fed by device gathers).
fortran
subroutine seam_sync_fluxes_dev(self, q_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
q_gpu | real(kind=R8P) | in | Conservative variables of the stage. |
Call graph
seam_sync_factors_dev
Seam synchronisation, second phase (issue #50; host twin of the CPU seam_sync_factors): gather the seam cells' stencils, auxiliary variables and face fluxes, recompute their factors with the seam faces overridden on the host, scatter them to the device factors.
fortran
subroutine seam_sync_factors_dev(self, q_gpu, dbad, dnonfinite)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
q_gpu | real(kind=R8P) | in | Conservative variables of the stage. | |
dbad | integer(kind=I4P) | inout | Inadmissible backbones count. | |
dnonfinite | integer(kind=I4P) | inout | Non-finite cells count. |
Call graph
seam_sync_theta_dev
Seam synchronisation, third phase (issue #50; host twin of the CPU seam_sync_theta).
fortran
subroutine seam_sync_theta_dev(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
seam_sync_blend_dev
Seam synchronisation, last phase (issue #50; host twin of the CPU seam_sync_blend): the seam face fluxes with the seam factor, scattered to the device face fluxes.
fortran
subroutine seam_sync_blend_dev(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
save_residuals
Save residuals history (L2 norm of dq on the device, MPI-reduced, rank 0 writes).
fortran
subroutine save_residuals(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
save_simulation_data
Save fields, restart, slices and conservation history, each on its own cadence; state copied to host only when saved.
fortran
subroutine save_simulation_data(self, realm)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
realm | type(realm_pointer) | inout | target, optional | Sibling realms. |
Call graph
set_boundary_conditions
Set boundary conditions on the device crown maps: three passes (rows beyond one, two, three realm faces), crown by crown within each (see the CPU set_boundary_conditions, issue #65 P0).
fortran
subroutine set_boundary_conditions(self, q_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
q_gpu | real(kind=R8P) | inout | Conservative variables. |
Call graph
build_bc_pass_rows
Group the rows of the BC crown map by pass, per crown, for set_boundary_conditions (issue #90, F-A'): pass p (rows beyond p realm faces: 1 faces, 2 edges, 3 corners) of crown c is bc_rows_gpu(r1:r2,c), with [r1, r2] = bc_pass_range(:,p,c) (empty when r2 < r1), so each launch visits its own rows only. The rows are the live ones (block > 0) in map order; built from the host map, after every copy of the device map.
fortran
subroutine build_bc_pass_rows(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
inflow_df_to_device
List the digital-filter inflow ghost rows from the host map and copy them and their states to the device (issue #119, T3.7): once per step (the states change) and after every copy of the map. The device arrays hold at least one column, so a rank without rows copies no zero-size array (issue #82).
fortran
subroutine inflow_df_to_device(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
wall_history_to_host
Copy the committed state to the host for the wall-model history (issue #119, T3.7): the blocks in use only, the state only.
fortran
subroutine wall_history_to_host(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
inflow_rr_gather
Gather the recycling plane's cells of this rank (bc%rr%rec_cells, (i, j, k, b)) from the device state (issue #121, S5).
fortran
subroutine inflow_rr_gather(self, q_rec)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
q_rec | real(kind=R8P) | inout | Conservative state of the cells [5, nrec]. |
Call graph
inflow_rr_to_device
List the recycling inflow ghost rows from the host map and the plane of the step, and copy them and their states to the device (issue #121, S5): once per step (the plane changes) and after every copy of the map; none before the first plane. The device arrays hold at least one column, so a rank without rows copies no zero-size array (issue #82).
fortran
subroutine inflow_rr_to_device(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
free_inflow_rr_rows
Free the device recycling inflow rows.
fortran
subroutine free_inflow_rr_rows(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
free_inflow_df_rows
Free the device digital-filter inflow rows.
fortran
subroutine free_inflow_df_rows(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
update_ghost
Update ghost cells on the device: intra-realm local copies, GPU-direct MPI exchange, boundary conditions, then the positivity blend of the inadmissible face ghosts (issue #50, D2; see the CPU update_ghost). With ib_rows, the local copies and the MPI exchange fill only the ghost cells the eikonal sweeps read (ib_maps, #156 L2); the device copy of those maps follows their host builds.
fortran
subroutine update_ghost(self, q_gpu, ib_rows)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
q_gpu | real(kind=R8P) | inout | Conservative variables. | |
ib_rows | logical | in | optional | Only the ghost cells of the eikonal sweeps. |
Call graph
advance_one_step_forest
Advance one full step of size dt (fast path: single realm, no AMR seam faces).
fortran
subroutine advance_one_step_forest(self, dt)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
dt | real(kind=R8P) | in | Time step from the forest's global reduction. |
Call graph
after_topology_build_forest
Copy the host maps the forest built after the realm initialization to the device: the inter-realm seam map and buffers (maps%seam_local_*) and the BC crown map, whose seam rows the forest rewrote to BC_SEAM (issue #37; without it the seam fill kernel reads an unset device map and the BC kernel extrapolates over the seam ghosts).
fortran
subroutine after_topology_build_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
apply_reflux_to_stage_forest
Apply the Berger-Colella reflux correction to the committed q_gpu (the forest calls it once per step, after close_step_forest, with the final stage); device twin of the CPU apply.
For every register face whose coarse side this realm and this rank own, the host mismatch slab F_coarse - F_fine_sum (step fluxes, sum_s beta_s F_s) is copied to the device and added, scaled by sgn dt / dx_coarse, to the coarse skin cells.
The scale uses the step the update used, time%dt: on the last step of a time-driven run the realm caps it to land on time_max, and the forest's dt argument is the uncapped value (with it the correction was off by the ratio of the two, 1.3e-9 of the mass on sod-amr; issue #37).
fortran
subroutine apply_reflux_to_stage_forest(self, stage, dt, flux_register)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
stage | integer(kind=I4P) | in | Integrator stage. | |
dt | real(kind=R8P) | in | Forest time step (unused: see the scale below). | |
flux_register | class(flux_register_object) | in | Forest's flux register. |
Call graph
begin_stage_forest
Begin integrator stage k (staged path): publish the stage and compute its state.
fortran
subroutine begin_stage_forest(self, k, K_total, dt, realm)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
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 | Time step from the forest. | |
realm | type(realm_pointer) | inout | target, optional | Sibling realms (contract parity). |
Call graph
close_step_forest
Close a step (staged path): assemble q, save residuals, advance time, clear the active stage.
fortran
subroutine close_step_forest(self, dt)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
dt | real(kind=R8P) | in | Time step from the forest (the local capped value is time%dt). |
Call graph
compute_local_dt_forest
Compute the local stability-limited time step on the device, dt = CFL / max(sum_d (|u_d| + a) / dx_d); with GLM, also dt <= CFL / (c_h max sum_d 1 / dx_d) (glm_lambda, host data, issue #41, section 3.5); with dissipative terms the diffusive part 2 nu sum_d 1 / dx_d^2 joins the cell sum (issue #65, D-M4-3, as on the CPU).
fortran
subroutine compute_local_dt_forest(self, dt_local)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | in | The equation. | |
dt_local | real(kind=R8P) | out | Local stability-limited time step. |
Call graph
end_stage_forest
End integrator stage k (staged path): the residual of the stage state into dq_gpu (the per-stage reflux corrects it there), copied into the stepper's residual register, then the stepper closes the stage.
fortran
subroutine end_stage_forest(self, k, K_total, dt, realm, flux_register)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
k | integer(kind=I4P) | in | Stage index (1..K_total). | |
K_total | integer(kind=I4P) | in | Forest-wide stage count. | |
dt | real(kind=R8P) | in | Time step from the forest. | |
realm | type(realm_pointer) | inout | target, optional | Sibling realms (parity only). |
flux_register | class(flux_register_object) | inout | optional | Forest's flux register. |
Call graph
reflux_stage
The per-stage reflux ([numerics] reflux_cadence = stage, issue #81 P5c; FNL twin of the CPU reflux_stage): the seam fluxes of stage s (with the seam gravity work) into the realm's register copy with weight 1, completed across the ranks; each coarse seam face's mismatch F_coarse - F_fine goes to the device and corrects the stage residual dq_gpu by sgn / H (apply_reflux_face_dev). The end-of-step reflux is then skipped.
fortran
subroutine reflux_stage(self, s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
s | integer(kind=I4P) | in | Runge-Kutta stage. |
Call graph
fill_seam_from_peer_forest
Fill this realm's seam ghosts for peer slot p_idx from the peer's interior, on the active device buffers of both realms (#132 rule 2): the stepper's stage state while a stage is open and its state is not q_gpu, else q_gpu.
fortran
subroutine fill_seam_from_peer_forest(self, peer, p_idx)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
peer | class(realm_object) | in | target | Peer realm. |
p_idx | integer(kind=I4P) | in | Peer slot. |
Call graph
pack_seam_cells_forest
Pack the ghost values of the seam send rows of peer slot p_idx from the active device buffer (#132 rule 2: the stepper's stage state while a stage is open and its state is not q_gpu, else q_gpu) into the host buf, nv values per row: cell copies, or the 2:1 interpolations and restrictions of a refined seam (issues #40, #52).
fortran
subroutine pack_seam_cells_forest(self, p_idx, buf)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | in | The equation. | |
p_idx | integer(kind=I4P) | in | Peer slot (the realm owning the ghosts). | |
buf | real(kind=R8P) | out | Packed values. |
Call graph
unpack_seam_cells_forest
Unpack the host buf into this realm's seam ghosts of the cross-rank receive rows of peer slot p_idx, on the active device buffer, nv values per row (issue #40).
fortran
subroutine unpack_seam_cells_forest(self, p_idx, buf)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
p_idx | integer(kind=I4P) | in | Peer slot (the realm owning the cells). | |
buf | real(kind=R8P) | in | Packed values. |
Call graph
finalize_forest
Finalize the realm: close the output files and free device and host data (MPI is finalized once by the forest).
fortran
subroutine finalize_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
initialize_process_context
Initialize the process context once (the forest calls it before any realm, #80 P3): the FNL handler (device binding, ranks sharing the device) first, since it may also be the MPI init, then the CPU handler.
fortran
subroutine initialize_process_context(self, verbose)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation (carries no MPI state). | |
verbose | logical | in | optional | Trigger verbose output. |
Call graph
finalize_mpi_forest
Finalize the FNL MPI handler (called once by the forest after every realm is finalized).
fortran
subroutine finalize_mpi_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation (carries no MPI state). |
Call graph
initialize_app_forest
Template hook: the FNL backend.
fortran
subroutine initialize_app_forest(self, filename, realms_number)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
filename | character(len=*) | in | Input file name. | |
realms_number | integer(kind=I4P) | in | optional | Realm count; divides the device budget. |
Call graph
restart_state_forest
Template hook: the state from the restart files (host) and the solids distance on it.
fortran
subroutine restart_state_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
amr_update_initial_forest
Template hook: one initial regrid (host).
fortran
subroutine amr_update_initial_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
rebalance_initial_forest
Template hook: a static grid is never derefined again: balance its blocks by count, sibling sets split (issue #123, key [amr] balance_static, default on); the initial conditions are imposed on the final layout after it.
fortran
subroutine rebalance_initial_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
post_initial_state_forest
Template hook: the state and the potential to the device, the sinks, ghost update, auxiliary fields, the faces of the wall model and of the hybrid scheme, the output files, the initial output, the AMR lock.
fortran
subroutine post_initial_state_forest(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
is_done_forest
Return true if the realm has reached its end.
fortran
subroutine is_done_forest(self, done)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | in | The equation. | |
done | logical | out | True if the realm is done. |
Call graph
open_step_forest
Open a step (staged path): time bookkeeping and Runge-Kutta stages initialization.
fortran
subroutine open_step_forest(self, dt)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
dt | real(kind=R8P) | in | Time step from the forest. |
Call graph
seam_ghosts_to_state
Copy the ghosts of q_gpu of the end_of_step seams into the stepper's stage state (#132 rule 1, issue #113): the stage reads the peer state of the last exchange (the device twin of adam_seam_exchange%seam_ghosts_to_state).
fortran
subroutine seam_ghosts_to_state(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
post_step_forest
Post-step work: the non-finite state check, the GLM c_h check, the div(B) history (MHD), fields, restart and conservation history on their cadence.
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(flume_fnl_object) | inout | The equation. | |
dt | real(kind=R8P) | in | Time step just advanced. | |
t | real(kind=R8P) | in | Time after the advance. | |
it | integer(kind=I4P) | in | Iteration after the advance. | |
do_save_state | logical | in | optional | Unused: cadence is internal. |
do_save_residuals | logical | in | optional | Unused: cadence is internal. |
do_save_restart | logical | in | optional | Unused: cadence is internal. |
do_amr | logical | in | optional | Unused: the forest regrids (regrid_forest). |
realm | type(realm_pointer) | inout | target, optional | Sibling realms. |
Call graph
sync_dual_energy
Synchronise the total energy and the advected entropy of the committed device state, once per step (issue #91): the device twin of the CPU sync_dual_energy (sync_dual_energy_dev, the same rule), the lifted cells and the energy added summed over the ranks and logged when nonzero.
fortran
subroutine sync_dual_energy(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
refresh_sink_accelerations_fnl
Re-solve the self-gravity potential of the committed device state and the mesh gravity at the sinks (issue #94).
fortran
subroutine refresh_sink_accelerations_fnl(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
apply_cooling
Cool the committed device state over the step just advanced, once per step (issue #93): the device twin of the CPU apply_cooling (apply_cooling_dev, or apply_cooling_entropy_dev with the advected entropy, the same rule and the same library arithmetic); the radiated energy summed over the ranks into cooling%radiated.
fortran
subroutine apply_cooling(self, dt)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
dt | real(kind=R8P) | in | Time step just advanced. |
Call graph
accrete_sinks_gpu
Threshold accretion of the committed device state (issue #94): the cells within an accretion radius of a sink are gathered from the device, accreted on the host by accrete_cells (the arithmetic of the CPU backend) and scattered back; a handful of cells per sink cross the bus.
fortran
subroutine accrete_sinks_gpu(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
cooling_tables
Return the cooling tables padded to the fixed size of the device kernels (COOLING_NODES_MAX, issue #93): node temperatures, Lambda, exponents and evolution function in the columns, zero beyond the n_nodes used.
Attributes: pure
fortran
subroutine cooling_tables(cooling, tables)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
cooling | type(flume_cooling_object) | in | Cooling. | |
tables | real(kind=R8P) | out | Padded tables. |
Call graph
regrid_forest
Regrid the realm on the cadence of [amr] frequency (issue #74, M5-P3); the forest calls it after every step, before post_step, on the committed state (single realm: a multi-realm forest calls the phases itself, #110).
A host round trip (D-M5-7): the regrid machinery (markers, tree, transfers, redistribution, maps) is the host library's, so each sweep refreshes the ghost cells on the device (the markers and the prolongation read them), copies q to the host, marks (mark_runtime) and regrids there (adam_object%amr_update with [amr] regrid_prolongation), and, on a changed grid, recomputes the solids' distance function and copies the state, the block coordinates, the maps (a map the new grid no longer has is freed on the device, issue #74 G6) and the distance function back to the device. Then, as on the CPU, the new state is checked and its ghosts and auxiliary variables refreshed. The device arrays are sized by the block capacity nb, so nothing is reallocated; the state and distance function copies move the blocks in use only, packed and transposed on the device (issue #75: the whole capacity cost 2.3-3.1 s per regrid on the development box, whatever the grid). The wall time of the regrid (largest over the ranks) is logged with it. regridded tells the forest to rebuild the 2:1 flux register (host side); the grid is replicated, so every rank returns the same value. The phases are regrid_begin_forest, regrid_mark_forest and regrid_apply_forest per sweep, regrid_end_forest.
fortran
subroutine regrid_forest(self, regridded)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
regridded | logical | out | True if the grid changed. |
Call graph
regrid_begin_forest
Start a regrid: active on a regrid step of [amr] frequency (issue #110).
fortran
subroutine regrid_begin_forest(self, active)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
active | logical | out | The realm marks its blocks at this step. |
Call graph
regrid_mark_forest
Sweep sweep of a regrid step: refresh the ghosts on the device, copy q to the host, mark there and gather the marks on the replicated tree (issue #110).
fortran
subroutine regrid_mark_forest(self, sweep, marked)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
sweep | integer(kind=I4P) | in | Sweep, from 1. | |
marked | logical | out | The realm marked its blocks. |
Call graph
regrid_apply_forest
Adapt to the marks on the replicated tree, on the host (adam_object%amr_update_apply); on a changed grid, recompute the solids' distance function and copy the state, the block coordinates, the maps and the distance function back to the device, then the potential and the sinks' gravity (issue #110).
fortran
subroutine regrid_apply_forest(self, changed)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
changed | logical | out | The tree changed. |
Call graph
regrid_end_forest
End a regrid: on a changed grid, check the new state, refresh its ghosts and auxiliary variables and log the wall time of the regrid (issue #110).
fortran
subroutine regrid_end_forest(self, regridded)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
regridded | logical | out | The grid changed in some sweep. |
Call graph
copy_blocks_transposed
Copy blocks 1:blocks_number of a field between the host a(v, i, j, k, b) and the device a_gpu(b, i, j, k, v), ghost cells included (issue #75). The blocks in use are a strided section of a_gpu (the block is its leading index) but a contiguous slab of a: a device kernel packs (or unpacks) them, transposed, into a scratch buffer of the slab's shape, moved by one contiguous copy. The buffer has the extent of the slab, the host side is the slab itself: no staging buffer of another extent (issue #31). A rank without blocks copies nothing.
fortran
subroutine copy_blocks_transposed(blocks_number, ni, nj, nk, ngc, nv, a, a_gpu, to_device)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
blocks_number | integer(kind=I4P) | in | Blocks to copy. | |
ni | integer(kind=I4P) | in | Block dimensions, ghosts. | |
nj | integer(kind=I4P) | in | Block dimensions, ghosts. | |
nk | integer(kind=I4P) | in | Block dimensions, ghosts. | |
ngc | integer(kind=I4P) | in | Block dimensions, ghosts. | |
nv | integer(kind=I4P) | in | Variables number. | |
a | real(kind=R8P) | inout | target, contiguous | Host field (v, i, j, k, b). |
a_gpu | real(kind=R8P) | in | pointer | Device field (b, i, j, k, v). |
to_device | logical | in | Host to device, else back. |
Call graph
refresh_equilibrium_residual
Recompute the residual of the hydrostatic equilibrium when the grid it describes is gone (issue #73, M7-G2b; device twin of the CPU procedure): the equilibrium is set on the host (ic%set_equilibrium) and copied into a scratch device field, its residual evaluated into dq_e_gpu; at AMR 2:1 seams the equilibrium's seam fluxes are accumulated with weight 1 into the realm's copy of the register, completed across the ranks, and their mismatch stored per face (seam_e) for the reflux to subtract.
fortran
subroutine refresh_equilibrium_residual(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
compute_gravity_correction
Compute the fourth-order correction of the gravity energy source into gcor_gpu (issue #73, M7-G2a; device twin of the CPU compute_gravity_correction): the faces of the block, then the face beyond each end of every direction with gravity, by the edge kernel of the space operator's face, selected here outside the kernels.
fortran
subroutine compute_gravity_correction(self, q_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
q_gpu | real(kind=R8P) | in | Conservative variables. |
Call graph
compute_residuals_weno_dev
Compute the residuals with the WENO space operator on the device: ghost update, auxiliary variables, face fluxes of the active directions, flux difference.
The face fluxes of a null direction are never computed: they keep their zero initialization (dev_alloc). On the staged path (AMR seam faces), the seam face fluxes of every stage are accumulated into the forest's flux register.
fortran
subroutine compute_residuals_weno_dev(self, q_gpu, dq_gpu, s, flux_register)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
q_gpu | real(kind=R8P) | inout | Conservative variables. | |
dq_gpu | real(kind=R8P) | inout | Residuals. | |
s | integer(kind=I4P) | in | optional | Runge-Kutta stage. |
flux_register | class(flux_register_object) | inout | optional | Forest's flux register for reflux. |
Call graph
compute_residuals_riemann_dev
Compute the residuals with the weno-riemann space operator on the device (issue #47): as compute_residuals_weno_dev, with the face fluxes of the WENO interpolation, the Riemann solver and the high-order correction. The host selects the kernel of the (model, solver) pair; a pair without kernels is fatal.
fortran
subroutine compute_residuals_riemann_dev(self, q_gpu, dq_gpu, s, flux_register)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
q_gpu | real(kind=R8P) | inout | Conservative variables. | |
dq_gpu | real(kind=R8P) | inout | Residuals. | |
s | integer(kind=I4P) | in | optional | Runge-Kutta stage. |
flux_register | class(flux_register_object) | inout | optional | Forest's flux register for reflux. |
Call graph
integrate_rk_ls_dev
Integrate one time step with a low-storage Runge-Kutta scheme on the device: SELAH's two-register form, every stage on q_gpu; the residual of each stage into dq_gpu (the residual log is stage 1's), copied into the stepper's residual register.
fortran
subroutine integrate_rk_ls_dev(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
integrate_rk_ssp_dev
Integrate one time step with a strong stability preserving Runge-Kutta scheme on the device: SELAH's Butcher form, each stage state on the stepper's register; the residual into dq_gpu, copied into the residual register; the step closes with the step residual dq = sum_s b_s R_s (0 in the solid cells, #128 D4).
fortran
subroutine integrate_rk_ssp_dev(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
ts_begin_step
Open the stepper's step on q_gpu; the solid cells are masked with immersed solids.
fortran
subroutine ts_begin_step(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
ts_begin_stage
Open stage s of the stepper: its state; the solid cells are masked with immersed solids.
fortran
subroutine ts_begin_stage(self, s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
s | integer(kind=I4P) | in | Stage. |
Call graph
ts_end_stage
Close stage s of the stepper (the two-register forms advance q_gpu here); masked with immersed solids.
fortran
subroutine ts_end_stage(self, s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. | |
s | integer(kind=I4P) | in | Stage. |
Call graph
ts_finish_step
Close the stepper's step: the Butcher form advances q_gpu and gives the step residual in dq_gpu.
fortran
subroutine ts_finish_step(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | inout | The equation. |
Call graph
seam_gather_cells
Gather on the host out(v, m) = the first nv components of the device field a_gpu at cells(:, m) (issue #50).
fortran
subroutine seam_gather_cells(cells, nv, ngc, a_gpu, out)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
cells | integer(kind=I4P) | in | Cells (i, j, k, b) [4, n]. | |
nv | integer(kind=I4P) | in | Components. | |
ngc | integer(kind=I4P) | in | Ghost cells number. | |
a_gpu | real(kind=R8P) | in | Device field. | |
out | real(kind=R8P) | inout | Gathered values [nv, n]. |
Call graph
seam_gather_stencils
Gather on the host the axis stencils of half width s around cells(:, m) (issue #50).
fortran
subroutine seam_gather_stencils(cells, nv, ngc, s, q_gpu, out)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
cells | integer(kind=I4P) | in | Cells (i, j, k, b) [4, n]. | |
nv | integer(kind=I4P) | in | Variables number. | |
ngc | integer(kind=I4P) | in | Ghost cells number. | |
s | integer(kind=I4P) | in | Stencil half width. | |
q_gpu | real(kind=R8P) | in | Device conservative variables. | |
out | real(kind=R8P) | inout | Stencils [nv, 2 s + 1, 3, n]. |
Call graph
seam_gather_faces
Gather on the host the device face fluxes at faces(:, m) = (axis, i, j, k, b) (issue #50).
fortran
subroutine seam_gather_faces(faces, nv, flx_f_gpu, fly_f_gpu, flz_f_gpu, out)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
faces | integer(kind=I4P) | in | Faces [5, n]. | |
nv | integer(kind=I4P) | in | Variables number. | |
flx_f_gpu | real(kind=R8P) | in | X-face fluxes. | |
fly_f_gpu | real(kind=R8P) | in | Y-face fluxes. | |
flz_f_gpu | real(kind=R8P) | in | Z-face fluxes. | |
out | real(kind=R8P) | inout | Gathered fluxes [nv, n]. |
Call graph
seam_scatter_faces
Set the device face fluxes at faces(:, m) = (axis, i, j, k, b) to the host in(:, m) (issue #50).
fortran
subroutine seam_scatter_faces(faces, nv, in, flx_f_gpu, fly_f_gpu, flz_f_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
faces | integer(kind=I4P) | in | Faces [5, n]. | |
nv | integer(kind=I4P) | in | Variables number. | |
in | real(kind=R8P) | in | Fluxes [nv, n]. | |
flx_f_gpu | real(kind=R8P) | inout | X-face fluxes. | |
fly_f_gpu | real(kind=R8P) | inout | Y-face fluxes. | |
flz_f_gpu | real(kind=R8P) | inout | Z-face fluxes. |
Call graph
seam_scatter_cells
Set the first nv components of the device field a_gpu at cells(:, m) to the host in(:, m) (issue #50).
fortran
subroutine seam_scatter_cells(cells, nv, ngc, in, a_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
cells | integer(kind=I4P) | in | Cells (i, j, k, b) [4, n]. | |
nv | integer(kind=I4P) | in | Components. | |
ngc | integer(kind=I4P) | in | Ghost cells number. | |
in | real(kind=R8P) | in | Values [nv, n]. | |
a_gpu | real(kind=R8P) | inout | Device field. |
Call graph
Functions
cooling_time_min
Return the shortest cooling time of the committed device state on this rank (compute_cooling_time_min_dev), for the [cooling].(dt_factor) limiter (issue #93).
Returns: real(kind=R8P)
fortran
function cooling_time_min(self) result(t_cool)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | in | The equation. |
Call graph
stages_per_step_forest
Return the integrator stages per step: only the Butcher form is stage-splittable (staged path).
Returns: integer(kind=I4P)
fortran
function stages_per_step_forest(self) result(K)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(flume_fnl_object) | in | The equation. |
Call graph