Appearance
adam_prism_cpu_object
ADAM, PRISM (Plasma Research usIng Simulation Methods) equations system class definition, CPU backend.
Source: src/app/prism/cpu/adam_prism_cpu_object.F90
Dependencies
Contents
- prism_cpu_object
- compute_residuals_interface
- integrate_interface
- allocate_cpu
- initialize
- save_residuals
- save_simulation_data
- compute_coils_current
- apply_fWL_correction
- set_boundary_conditions
- compute_residuals_BC
- set_initial_conditions
- update_ghost
- compute_auxiliary_fields
- compute_dt
- compute_energy
- compute_energy_error
- impose_div_free
- impose_ct_correction
- simulate
- compute_residuals_fd_centered
- compute_residuals_fv_centered
- compute_residuals_weno
- integrate_blanesmoan
- integrate_cfm
- integrate_leapfrog
- integrate_leapfrog_pic
- integrate_rk_ls
- integrate_rk_ssp
- integrate_rk_ssp_pic
- update_q_BC
- integrate_rk_yoshida
- compute_dxyz_min
- compute_fluxes_convective_weno
- compute_fluxes_convective_ri_weno
- compute_fluxes_difference
- decompose_fluxes_convective
- impose_div_coil_correction
- write_current_behavior_tab
- write_single_particle_output
- compute_field_mean_value
- dotproduct
- crossproduct
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
compute_fluxes_Maxwell | procedure(compute_convective_fluxes_interface) | pointer | Compute convective fluxes. |
Derived Types
prism_cpu_object
Maxwell equations system class definition, CPU backend.
Extends: prism_common_object
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
flxyz_c | real(kind=R8P) | allocatable | Fluxes at cell center with +/- decomposition for all directions. |
flx_f | real(kind=R8P) | allocatable | Fluxes along x at cell face. |
fly_f | real(kind=R8P) | allocatable | Fluxes along y at cell face. |
flz_f | real(kind=R8P) | allocatable | Fluxes along z at cell face. |
compute_residuals | procedure(compute_residuals_interface) | pass(self), pointer | Compute residuals, space operator. |
integrate | procedure(integrate_interface) | pass(self), pointer | Integrate, time operator. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
allocate_cpu | pass(self) | Allocate CPU data. |
initialize | pass(self) | Initialize the equation. |
save_residuals | pass(self) | Save residuals history. |
save_simulation_data | pass(self) | Save all simulation data. |
apply_fWL_correction | pass(self) | Apply fWLayer correction (if present) |
compute_coils_current | pass(self) | Compute current coils sources. |
impose_div_coil_correction | pass(self) | Impose coil divergence correction. |
set_boundary_conditions | pass(self) | Set boundary conditions of equation. |
compute_residuals_BC | pass(self) | |
update_q_BC | pass(self) | |
set_initial_conditions | pass(self) | Set initial conditions (and coils) of equation. |
update_ghost | pass(self) | Update ghost cells and set boundary conditions. |
compute_field_mean_value | pass(self) | Compute field mean value. |
compute_auxiliary_fields | pass(self) | Compute auxiliary fields. |
compute_dt | pass(self) | Compute time step. |
compute_energy | pass(self) | Compute energy. |
compute_energy_error | pass(self) | Compute energy error. |
impose_div_free | pass(self) | Impose divergence-free property. |
impose_ct_correction | pass(self) | Impose Constrained Transport correction on q(ivar:ivar+2). |
simulate | pass(self) | Perform the simulation. |
Interfaces
compute_residuals_interface
integrate_interface
Subroutines
allocate_cpu
Allocate CPU data.
fortran
subroutine allocate_cpu(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
initialize
Initialize the equation.
fortran
subroutine initialize(self, filename)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. | |
filename | character(len=*) | in | Input file name. |
Call graph
save_residuals
Save residuals history.
fortran
subroutine save_residuals(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
save_simulation_data
Save all simulation data.
fortran
subroutine save_simulation_data(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
compute_coils_current
Compute current coils sources (DC/AC with smooth envelope).
fortran
subroutine compute_coils_current(self, q, gamma)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | ||
q | real(kind=R8P) | inout | ||
gamma | real(kind=R8P) | in | optional |
Call graph
apply_fWL_correction
Apply correction if a fWL is present
fortran
subroutine apply_fWL_correction(self, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. | |
q | real(kind=R8P) | inout | Conservative variables. |
Call graph
set_boundary_conditions
Set boundary conditions of equation.
fortran
subroutine set_boundary_conditions(self, q, s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. | |
q | real(kind=R8P) | inout | Conservative variables. | |
s | integer(kind=I4P) | in | optional | Stage counter. |
Call graph
compute_residuals_BC
Compute residuals BCs. La sua scrittura si lega all'ordine di interpolazione dell'operatore spaziale. Al momento e' scritto per operatore di secondo ordine (1 punto ghost).
fortran
subroutine compute_residuals_BC(self, s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. | |
s | integer(kind=I4P) | in | Stage counter. |
Call graph
set_initial_conditions
Set initial conditions and coils on field.
fortran
subroutine set_initial_conditions(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
update_ghost
Update ghost cells. If not specified all steps are perfermod, syncronous computation
fortran
subroutine update_ghost(self, q, step, s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. | |
q | real(kind=R8P) | inout | Conservative variables. | |
step | integer(kind=I4P) | in | optional | Step to be perfordmed in asyncronous comp. |
s | integer(kind=I4P) | in | optional | Stage counter. |
Call graph
compute_auxiliary_fields
Compute auxiliary fields.
fortran
subroutine compute_auxiliary_fields(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
compute_dt
fortran
subroutine compute_dt(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
compute_energy
Compute energy.
fortran
subroutine compute_energy(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
compute_energy_error
Compute energy error.
fortran
subroutine compute_energy_error(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
impose_div_free
Impose divergence-free property.
fortran
subroutine impose_div_free(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
impose_ct_correction
Impose Constrained Transport Correction on vectorial variable q(ivar:ivar+2). Note that self%divergence memory is used as buffer, be careful.
fortran
subroutine impose_ct_correction(self, ivar)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. | |
ivar | integer(kind=I4P) | in | Variable (start) index in q. |
Call graph
simulate
Perform the simulation. Pic residual computation
Integration of equations
fortran
subroutine simulate(self, filename)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. | |
filename | character(len=*) | in | Input file name. |
Call graph
compute_residuals_fd_centered
Compute residuals of equation, space operator, centered finite difference schemes.
fortran
subroutine compute_residuals_fd_centered(self, q, dq, s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. | |
q | real(kind=R8P) | inout | Conservative variables. | |
dq | real(kind=R8P) | inout | Residuals. | |
s | integer(kind=I4P) | in | optional | Stage counter. |
Call graph
compute_residuals_fv_centered
Compute residuals of equation, space operator, centered finite volume schemes.
fortran
subroutine compute_residuals_fv_centered(self, q, dq, s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. | |
q | real(kind=R8P) | inout | Conservative variables. | |
dq | real(kind=R8P) | inout | Residuals. | |
s | integer(kind=I4P) | in | optional | Stage counter. |
Call graph
compute_residuals_weno
Compute residuals of equation, space operator, WENO schemes.
fortran
subroutine compute_residuals_weno(self, q, dq, s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. | |
q | real(kind=R8P) | inout | Conservative variables. | |
dq | real(kind=R8P) | inout | Residuals. | |
s | integer(kind=I4P) | in | optional | Stage counter. |
Call graph
integrate_blanesmoan
Integrate equation, time operator, Yoshida RK scheme.
fortran
subroutine integrate_blanesmoan(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
integrate_cfm
Integrate equation, time operator, Commutator-Free Magnus integrator.
fortran
subroutine integrate_cfm(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
integrate_leapfrog
Integrate equation, time operator, leapfrog scheme.
fortran
subroutine integrate_leapfrog(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
integrate_leapfrog_pic
Integrate equation, time operator, leapfrog scheme for particle in cell Maxwell residuals computation Pic residual computation Integration of equations
fortran
subroutine integrate_leapfrog_pic(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
integrate_rk_ls
Integrate equation, time operator, RK classical low storage schemes. Low storage RK working on q_rk(:,:,:,:,:,1)/q as stages, update q in place.
fortran
subroutine integrate_rk_ls(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
integrate_rk_ssp
Integrate equation, time operator, SSP RK schemes. SSP RK working on q_rk as stages.
fortran
subroutine integrate_rk_ssp(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
integrate_rk_ssp_pic
Integrate equation, time operator, SSP RK schemes. SSP RK working on q_rk as stages.
fortran
subroutine integrate_rk_ssp_pic(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
update_q_BC
Update RK q ghost cells.
fortran
subroutine update_q_BC(self, dt, phi)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | RK object. | |
dt | real(kind=R8P) | in | Current time step. | |
phi | real(kind=R8P) | in | optional | IB distance. |
Call graph
integrate_rk_yoshida
Integrate equation, time operator, Yoshida RK scheme.
fortran
subroutine integrate_rk_yoshida(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. |
Call graph
compute_dxyz_min
Compute minimum dxyz space step.
fortran
subroutine compute_dxyz_min(blocks_number, dxyz, dxyz_min)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
blocks_number | integer(kind=I4P) | in | Number of blocks. | |
dxyz | real(kind=R8P) | in | XYZ space steps. | |
dxyz_min | real(kind=R8P) | out | Minimum space step. |
Call graph
compute_fluxes_convective_weno
Compute convective fluxes along direction dir, WENO scheme for space operator.
fortran
subroutine compute_fluxes_convective_weno(dir, blocks_number, ni, nj, nk, ngc, nv_c, weno_s, weno_a, weno_p, weno_d, weno_c, weno_zeps, evmax, erw, elw, chi, q, fluxes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
dir | integer(kind=I4P) | in | Direction, 1=X, 2=Y, 3=Z. | |
blocks_number | integer(kind=I4P) | in | Number of blocks. | |
ni | integer(kind=I4P) | in | Grid cells number in I direction. | |
nj | integer(kind=I4P) | in | Grid cells number in J direction. | |
nk | integer(kind=I4P) | in | Grid cells number in K direction. | |
ngc | integer(kind=I4P) | in | Ghost cells number. | |
nv_c | integer(kind=I4P) | in | Number of conservative varibales. | |
weno_s | integer(kind=I4P) | in | Weno stencils number/dimension. | |
weno_a | real(kind=R8P) | in | Optimal weights. | |
weno_p | real(kind=R8P) | in | Polinomials coefficients. | |
weno_d | real(kind=R8P) | in | Smoothness indicators coefficients. | |
weno_c | real(kind=R8P) | in | Centered polinomials coefficients. | |
weno_zeps | real(kind=R8P) | in | Parameter for avoiding division by zero in computing IS. | |
evmax | real(kind=R8P) | in | Maximum waves speed estimation. | |
erw | real(kind=R8P) | in | Right eigenvectors for WENO reconstruction. | |
elw | real(kind=R8P) | in | Left eigenvectors for WENO reconstruction. | |
chi | real(kind=R8P) | in | Speed parameter for divergence cleaning. | |
q | real(kind=R8P) | in | Field variables. | |
fluxes | real(kind=R8P) | inout | Fluxes. |
Call graph
compute_fluxes_convective_ri_weno
Compute convective fluxes at right interface of b,i,j,k.
fortran
subroutine compute_fluxes_convective_ri_weno(dir, b, i, j, k, ngc, nv_c, weno_s, weno_zeps, weno_a, weno_p, weno_d, weno_c, evmax, erw, elw, chi, si, sir, q, fluxes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
dir | integer(kind=I4P) | in | Direction, 1=X, 2=Y, 3=Z. | |
b | integer(kind=I4P) | in | Counter. | |
i | integer(kind=I4P) | in | Counter. | |
j | integer(kind=I4P) | in | Counter. | |
k | integer(kind=I4P) | in | Counter. | |
ngc | integer(kind=I4P) | in | Ghost cells number. | |
nv_c | integer(kind=I4P) | in | Number of conservative varibales in q vector. | |
weno_s | integer(kind=I4P) | in | Weno stencils number/dimension. | |
weno_zeps | real(kind=R8P) | in | Parameter to avoid division by zero. | |
weno_a | real(kind=R8P) | in | Optimal weights. | |
weno_p | real(kind=R8P) | in | Polinomials coefficients. | |
weno_d | real(kind=R8P) | in | Smoothness indicators coefficients. | |
weno_c | real(kind=R8P) | in | Centered polinomials coefficients. | |
evmax | real(kind=R8P) | in | Maximum waves speed estimation. | |
erw | real(kind=R8P) | in | Right eigenvectors for WENO reconstruction. | |
elw | real(kind=R8P) | in | Left eigenvectors for WENO reconstruction. | |
chi | real(kind=R8P) | in | Speed parameter for divergence cleaning. | |
si | integer(kind=I4P) | in | Stencil increment. | |
sir | real(kind=R8P) | in | Stencil increment, real cast. | |
q | real(kind=R8P) | in | Fields variables. | |
fluxes | real(kind=R8P) | inout | Fluxes. |
Call graph
compute_fluxes_difference
Compute fluxes difference.
fortran
subroutine compute_fluxes_difference(blocks_number, ni, nj, nk, ngc, nv_c, var_Jx, var_Jy, var_Jz, dx, dy, dz, flx, fly, flz, q, dq)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
blocks_number | integer(kind=I4P) | in | Number of blocks. | |
ni | integer(kind=I4P) | in | Grid cells number in I direction. | |
nj | integer(kind=I4P) | in | Grid cells number in J direction. | |
nk | integer(kind=I4P) | in | Grid cells number in K direction. | |
ngc | integer(kind=I4P) | in | Ghost cells number. | |
nv_c | integer(kind=I4P) | in | Number of conservative varibales in q. | |
var_Jx | integer(kind=I4P) | in | Current variable indices. | |
var_Jy | integer(kind=I4P) | in | Current variable indices. | |
var_Jz | integer(kind=I4P) | in | Current variable indices. | |
dx | real(kind=R8P) | in | Space steps. | |
dy | real(kind=R8P) | in | Space steps. | |
dz | real(kind=R8P) | in | Space steps. | |
flx | real(kind=R8P) | in | X direction fluxes. | |
fly | real(kind=R8P) | in | Y direction fluxes. | |
flz | real(kind=R8P) | in | Z direction fluxes. | |
q | real(kind=R8P) | in | Fields. | |
dq | real(kind=R8P) | inout | Fluxes differences. |
Call graph
decompose_fluxes_convective
Decompose convective fluxes.
fortran
subroutine decompose_fluxes_convective(dir, si, sir, b, i, j, k, ngc, nv_c, weno_s, evmax, elw, q, chi, fmpc)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
dir | integer(kind=I4P) | in | Direction, 1=X, 2=Y, 3=Z. | |
si | integer(kind=I4P) | in | Stencil increment. | |
sir | real(kind=R8P) | in | Stencil increment, real cast. | |
b | integer(kind=I4P) | in | Counter. | |
i | integer(kind=I4P) | in | Counter. | |
j | integer(kind=I4P) | in | Counter. | |
k | integer(kind=I4P) | in | Counter. | |
ngc | integer(kind=I4P) | in | Ghost cells number. | |
nv_c | integer(kind=I4P) | in | Number of conservative varibales in q vector. | |
weno_s | integer(kind=I4P) | in | Weno stencils number/dimension. | |
evmax | real(kind=R8P) | in | Maximum eigenvalue. | |
elw | real(kind=R8P) | in | Left eigenvectors for WENO reconstruction. | |
q | real(kind=R8P) | in | Auxiliary variables. | |
chi | real(kind=R8P) | in | Speed coefficient for D & B div-cleaning. | |
fmpc | real(kind=R8P) | inout | Fluxes -+ decomposition in characteristics space. |
Call graph
impose_div_coil_correction
Impose Constrained Transport Correction on vectorial variable q(ivar:ivar+2). Note that self%divergence memory is used as buffer, be careful.
fortran
subroutine impose_div_coil_correction(self, ivar, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | inout | The equation. | |
ivar | integer(kind=I4P) | in | Variable (start) index in q. | |
q | real(kind=R8P) | inout | Field variables. |
Call graph
write_current_behavior_tab
fortran
subroutine write_current_behavior_tab(filename, current_density, time)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
filename | character(len=*) | in | ||
current_density | real(kind=R8P) | in | ||
time | real(kind=R8P) | in |
Call graph
write_single_particle_output
fortran
subroutine write_single_particle_output(filename, time, q_pic)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
filename | character(len=*) | in | ||
time | real(kind=R8P) | in | ||
q_pic | real(kind=R8P) | in |
Call graph
compute_field_mean_value
Compute mean value of the field in a certain region of the domain.
fortran
subroutine compute_field_mean_value(self, q, n_x, n_y, n_z, n_b, mean_value)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_cpu_object) | in | The object | |
q | real(kind=R8P) | in | Field variables. | |
n_x | integer(kind=I4P) | in | Number of cells in each direction and number of blocks | |
n_y | integer(kind=I4P) | in | Number of cells in each direction and number of blocks | |
n_z | integer(kind=I4P) | in | Number of cells in each direction and number of blocks | |
n_b | integer(kind=I4P) | in | Number of cells in each direction and number of blocks | |
mean_value | real(kind=R8P) | out | Mean value of the field out of the fWLayer |
Functions
dotproduct
Compute the scalar (dot) product.
Returns: real(kind=R8P)
fortran
function dotproduct(a, b) result(dot)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
a | real(kind=R8P) | in | Left hand side. | |
b | real(kind=R8P) | in | Left hand side. |
Call graph
crossproduct
Returns: real(kind=R8P)
fortran
function crossproduct(a, b) result(cross)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
a | real(kind=R8P) | in | Left hand side. | |
b | real(kind=R8P) | in | Left hand side. |
Call graph