Skip to content

adam_prism_cpu_object

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

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

Dependencies

Contents

Variables

NameTypeAttributesDescription
compute_fluxes_Maxwellprocedure(compute_convective_fluxes_interface)pointerCompute convective fluxes.

Derived Types

prism_cpu_object

Maxwell equations system class definition, CPU backend.

Extends: prism_common_object

Components

NameTypeAttributesDescription
flxyz_creal(kind=R8P)allocatableFluxes at cell center with +/- decomposition for all directions.
flx_freal(kind=R8P)allocatableFluxes along x at cell face.
fly_freal(kind=R8P)allocatableFluxes along y at cell face.
flz_freal(kind=R8P)allocatableFluxes along z at cell face.
compute_residualsprocedure(compute_residuals_interface)pass(self), pointerCompute residuals, space operator.
integrateprocedure(integrate_interface)pass(self), pointerIntegrate, time operator.

Type-Bound Procedures

NameAttributesDescription
allocate_cpupass(self)Allocate CPU data.
initializepass(self)Initialize the equation.
save_residualspass(self)Save residuals history.
save_simulation_datapass(self)Save all simulation data.
apply_fWL_correctionpass(self)Apply fWLayer correction (if present)
compute_coils_currentpass(self)Compute current coils sources.
impose_div_coil_correctionpass(self)Impose coil divergence correction.
set_boundary_conditionspass(self)Set boundary conditions of equation.
compute_residuals_BCpass(self)
update_q_BCpass(self)
set_initial_conditionspass(self)Set initial conditions (and coils) of equation.
update_ghostpass(self)Update ghost cells and set boundary conditions.
compute_field_mean_valuepass(self)Compute field mean value.
compute_auxiliary_fieldspass(self)Compute auxiliary fields.
compute_dtpass(self)Compute time step.
compute_energypass(self)Compute energy.
compute_energy_errorpass(self)Compute energy error.
impose_div_freepass(self)Impose divergence-free property.
impose_ct_correctionpass(self)Impose Constrained Transport correction on q(ivar:ivar+2).
simulatepass(self)Perform the simulation.

Interfaces

compute_residuals_interface

integrate_interface

Subroutines

allocate_cpu

Allocate CPU data.

fortran
subroutine allocate_cpu(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

initialize

Initialize the equation.

fortran
subroutine initialize(self, filename)

Arguments

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

Call graph

save_residuals

Save residuals history.

fortran
subroutine save_residuals(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

save_simulation_data

Save all simulation data.

fortran
subroutine save_simulation_data(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

compute_coils_current

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

fortran
subroutine compute_coils_current(self, q, gamma)

Arguments

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

Call graph

apply_fWL_correction

Apply correction if a fWL is present

fortran
subroutine apply_fWL_correction(self, q)

Arguments

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

Call graph

set_boundary_conditions

Set boundary conditions of equation.

fortran
subroutine set_boundary_conditions(self, q, s)

Arguments

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

Call graph

compute_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

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

Call graph

set_initial_conditions

Set initial conditions and coils on field.

fortran
subroutine set_initial_conditions(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe 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

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

Call graph

compute_auxiliary_fields

Compute auxiliary fields.

fortran
subroutine compute_auxiliary_fields(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

compute_dt

fortran
subroutine compute_dt(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

compute_energy

Compute energy.

fortran
subroutine compute_energy(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

compute_energy_error

Compute energy error.

fortran
subroutine compute_energy_error(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

impose_div_free

Impose divergence-free property.

fortran
subroutine impose_div_free(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe 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

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.
ivarinteger(kind=I4P)inVariable (start) index in q.

Call graph

simulate

Perform the simulation. Pic residual computation

Integration of equations

fortran
subroutine simulate(self, filename)

Arguments

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

Call graph

compute_residuals_fd_centered

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

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

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.
qreal(kind=R8P)inoutConservative variables.
dqreal(kind=R8P)inoutResiduals.
sinteger(kind=I4P)inoptionalStage 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

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

Call graph

compute_residuals_weno

Compute residuals of equation, space operator, WENO schemes.

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

Arguments

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

Call graph

integrate_blanesmoan

Integrate equation, time operator, Yoshida RK scheme.

fortran
subroutine integrate_blanesmoan(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

integrate_cfm

Integrate equation, time operator, Commutator-Free Magnus integrator.

fortran
subroutine integrate_cfm(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

integrate_leapfrog

Integrate equation, time operator, leapfrog scheme.

fortran
subroutine integrate_leapfrog(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe 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

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe 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

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe 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

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe 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

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

update_q_BC

Update RK q ghost cells.

fortran
subroutine update_q_BC(self, dt, phi)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutRK object.
dtreal(kind=R8P)inCurrent time step.
phireal(kind=R8P)inoptionalIB distance.

Call graph

integrate_rk_yoshida

Integrate equation, time operator, Yoshida RK scheme.

fortran
subroutine integrate_rk_yoshida(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.

Call graph

compute_dxyz_min

Compute minimum dxyz space step.

fortran
subroutine compute_dxyz_min(blocks_number, dxyz, dxyz_min)

Arguments

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

Call graph

compute_fluxes_convective_weno

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

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

NameTypeIntentAttributesDescription
dirinteger(kind=I4P)inDirection, 1=X, 2=Y, 3=Z.
blocks_numberinteger(kind=I4P)inNumber of blocks.
niinteger(kind=I4P)inGrid cells number in I direction.
njinteger(kind=I4P)inGrid cells number in J direction.
nkinteger(kind=I4P)inGrid cells number in K direction.
ngcinteger(kind=I4P)inGhost cells number.
nv_cinteger(kind=I4P)inNumber of conservative varibales.
weno_sinteger(kind=I4P)inWeno stencils number/dimension.
weno_areal(kind=R8P)inOptimal weights.
weno_preal(kind=R8P)inPolinomials coefficients.
weno_dreal(kind=R8P)inSmoothness indicators coefficients.
weno_creal(kind=R8P)inCentered polinomials coefficients.
weno_zepsreal(kind=R8P)inParameter for avoiding division by zero in computing IS.
evmaxreal(kind=R8P)inMaximum waves speed estimation.
erwreal(kind=R8P)inRight eigenvectors for WENO reconstruction.
elwreal(kind=R8P)inLeft eigenvectors for WENO reconstruction.
chireal(kind=R8P)inSpeed parameter for divergence cleaning.
qreal(kind=R8P)inField variables.
fluxesreal(kind=R8P)inoutFluxes.

Call graph

compute_fluxes_convective_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

NameTypeIntentAttributesDescription
dirinteger(kind=I4P)inDirection, 1=X, 2=Y, 3=Z.
binteger(kind=I4P)inCounter.
iinteger(kind=I4P)inCounter.
jinteger(kind=I4P)inCounter.
kinteger(kind=I4P)inCounter.
ngcinteger(kind=I4P)inGhost cells number.
nv_cinteger(kind=I4P)inNumber of conservative varibales in q vector.
weno_sinteger(kind=I4P)inWeno stencils number/dimension.
weno_zepsreal(kind=R8P)inParameter to avoid division by zero.
weno_areal(kind=R8P)inOptimal weights.
weno_preal(kind=R8P)inPolinomials coefficients.
weno_dreal(kind=R8P)inSmoothness indicators coefficients.
weno_creal(kind=R8P)inCentered polinomials coefficients.
evmaxreal(kind=R8P)inMaximum waves speed estimation.
erwreal(kind=R8P)inRight eigenvectors for WENO reconstruction.
elwreal(kind=R8P)inLeft eigenvectors for WENO reconstruction.
chireal(kind=R8P)inSpeed parameter for divergence cleaning.
siinteger(kind=I4P)inStencil increment.
sirreal(kind=R8P)inStencil increment, real cast.
qreal(kind=R8P)inFields variables.
fluxesreal(kind=R8P)inoutFluxes.

Call graph

compute_fluxes_difference

Compute fluxes difference.

fortran
subroutine compute_fluxes_difference(blocks_number, ni, nj, nk, ngc, nv_c, var_Jx, var_Jy, var_Jz, dx, dy, dz, flx, fly, flz, q, dq)

Arguments

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

Call graph

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

NameTypeIntentAttributesDescription
dirinteger(kind=I4P)inDirection, 1=X, 2=Y, 3=Z.
siinteger(kind=I4P)inStencil increment.
sirreal(kind=R8P)inStencil increment, real cast.
binteger(kind=I4P)inCounter.
iinteger(kind=I4P)inCounter.
jinteger(kind=I4P)inCounter.
kinteger(kind=I4P)inCounter.
ngcinteger(kind=I4P)inGhost cells number.
nv_cinteger(kind=I4P)inNumber of conservative varibales in q vector.
weno_sinteger(kind=I4P)inWeno stencils number/dimension.
evmaxreal(kind=R8P)inMaximum eigenvalue.
elwreal(kind=R8P)inLeft eigenvectors for WENO reconstruction.
qreal(kind=R8P)inAuxiliary variables.
chireal(kind=R8P)inSpeed coefficient for D & B div-cleaning.
fmpcreal(kind=R8P)inoutFluxes -+ 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

NameTypeIntentAttributesDescription
selfclass(prism_cpu_object)inoutThe equation.
ivarinteger(kind=I4P)inVariable (start) index in q.
qreal(kind=R8P)inoutField variables.

Call graph

write_current_behavior_tab

fortran
subroutine write_current_behavior_tab(filename, current_density, time)

Arguments

NameTypeIntentAttributesDescription
filenamecharacter(len=*)in
current_densityreal(kind=R8P)in
timereal(kind=R8P)in

Call graph

write_single_particle_output

fortran
subroutine write_single_particle_output(filename, time, q_pic)

Arguments

NameTypeIntentAttributesDescription
filenamecharacter(len=*)in
timereal(kind=R8P)in
q_picreal(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

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

Functions

dotproduct

Compute the scalar (dot) product.

Returns: real(kind=R8P)

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

Arguments

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

Call graph

crossproduct

Returns: real(kind=R8P)

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

Arguments

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

Call graph