neutrals_module_m Module

Implementation of NEUTRALS model



Contents


Variables

Type Visibility Attributes Name Initial
type(variable_t), public, save :: diff_co
real(kind=GP), public, dimension(:), allocatable, save :: diff_co_presmooth
real(kind=GP), public, dimension(:), allocatable, save :: src_floor_neutrals_dens

Derived Types

type, public ::  neutrals_module_t

Neutrals module responsible for evaluating neutrals-plasma source and time evolution of neutrals quantities

Components

Type Visibility Attributes Name Initial
type(source_gaussian_t), public :: gas_puff

Type-Bound Procedures

procedure , public :: init => init_neutrals Subroutine
procedure , public :: eval_sources => eval_sources_neutrals Subroutine
procedure , public :: timestep => timestep_neutrals Subroutine

Subroutines

public subroutine init_neutrals(self, comm_handler, equi, mesh_cano, mesh_stag, map, penalisation_cano, ne, neutrals_dens, neutrals_parmom, neutrals_pressure, isnaps_neutrals, tau)

Setup data structures for neutrals timestepping

Arguments

Type IntentOptional Attributes Name
class(neutrals_module_t), intent(inout) :: self

Instance of class

type(comm_handler_t), intent(in) :: comm_handler

Communicators

class(equilibrium_t), intent(inout) :: equi

Equilibrium

type(mesh_cart_t), intent(inout) :: mesh_cano

Mesh (canonical) within poloidal plane

type(mesh_cart_t), intent(inout) :: mesh_stag

Mesh (staggered) within poloidal plane

type(parallel_map_t), intent(in) :: map

Parallel map

type(penalisation_t), intent(in) :: penalisation_cano

Penalisation (canonical)

type(variable_t), intent(inout) :: ne

Electron density

type(variable_t), intent(inout) :: neutrals_dens

Neutrals density

type(variable_t), intent(inout) :: neutrals_parmom

Neutrals parallel momentum

type(variable_t), intent(inout) :: neutrals_pressure

Neutrals pressure

integer, intent(in) :: isnaps_neutrals

Snapshot number for neutrals

real(kind=GP), intent(in) :: tau

Time

public subroutine eval_sources_neutrals(self, comm_handler, equi, equi_on_cano, mesh_cano, mesh_stag, map, ne, pot, upar, te, ti, neutrals_dens, neutrals_parmom, neutrals_pressure, src_ne, src_upar, src_te, src_ti, src_vort)

Evaluate source terms to pass to Braginskii model

Arguments

Type IntentOptional Attributes Name
class(neutrals_module_t), intent(inout) :: self

Instance of class

type(comm_handler_t), intent(in) :: comm_handler

Communicators

class(equilibrium_t), intent(inout) :: equi

Equilibrium

class(equilibrium_storage_t), intent(inout) :: equi_on_cano

Equilibrim quantities on canonical mesh

type(mesh_cart_t), intent(inout) :: mesh_cano

Mesh (canonical) within poloidal plane

type(mesh_cart_t), intent(inout) :: mesh_stag

Mesh (staggered) within poloidal plane

type(parallel_map_t), intent(in) :: map

Parallel map

type(variable_t), intent(inout) :: ne

Plasma density at timestep t

type(variable_t), intent(in) :: pot

Electrostatic potential

type(variable_t), intent(inout) :: upar

Parallel ion velocity

type(variable_t), intent(in) :: te

Electron temperature at timestep t

type(variable_t), intent(in) :: ti

Ion temperature at timestep t

type(variable_t), intent(inout) :: neutrals_dens

Neutrals density, on input at t, on output advanced to t+1

type(variable_t), intent(inout) :: neutrals_parmom

Neutrals parallel momentum, on input at t, on output advanced to t+1

type(variable_t), intent(inout) :: neutrals_pressure

Neutrals pressure, on input at t, on output advanced to t+1

real(kind=GP), intent(inout), dimension(mesh_cano%get_n_points_inner()) :: src_ne

Plasma particle source, to which neutrals model contribution is added

real(kind=GP), intent(inout), dimension(mesh_stag%get_n_points_inner()) :: src_upar

Parallel momentum source, to which neutrtype(comm_handler_t), intent(in) :: comm_handler Communicatorsals model contribution is added

real(kind=GP), intent(inout), dimension(mesh_cano%get_n_points_inner()) :: src_te

Electron temperature source, to which neutrals model contribution is added

real(kind=GP), intent(inout), dimension(mesh_cano%get_n_points_inner()) :: src_ti

Ion temperature source, to which neutrals model contribution is added

real(kind=GP), intent(inout), dimension(mesh_cano%get_n_points_inner()) :: src_vort

Vorticity source, to which neutrals model contribution is added

public subroutine timestep_neutrals(self, comm_handler, equi, equi_on_cano, equi_on_stag, mesh_cano, mesh_stag, hsolver_cano, hsolver_stag, map, penalisation_cano, penalisation_stag, parflux_cano, parflux_stag, perp_bnd_flux_cano, perp_bnd_flux_stag, opsinplane_cano, opsinplane_stag, boundaries_neutrals, tau, ne, pot, upar, jpar, apar_fluct, te, ti, neutrals_dens, neutrals_parmom, neutrals_pressure, tstep_neutrals_dens, tstep_neutrals_parmom, tstep_neutrals_pressure, sinfo, res, success_neutrals)

Advances neutrals quantities from t to t+1

Arguments

Type IntentOptional Attributes Name
class(neutrals_module_t), intent(inout) :: self

Instance of class

type(comm_handler_t), intent(in) :: comm_handler

Communicators

class(equilibrium_t), intent(inout) :: equi

Equilibrium

class(equilibrium_storage_t), intent(inout) :: equi_on_cano

Equilibrim quantities on canonical mesh

class(equilibrium_storage_t), intent(inout) :: equi_on_stag

Equilibrim quantities on staggered mesh

type(mesh_cart_t), intent(inout) :: mesh_cano

Mesh (canonical) within poloidal plane

type(mesh_cart_t), intent(inout) :: mesh_stag

Mesh (staggered) within poloidal plane

class(helmholtz_solver_t), intent(inout) :: hsolver_cano

Elliptic (2D) solver on canonical mesh

class(helmholtz_solver_t), intent(inout) :: hsolver_stag

Elliptic (2D) solver on staggered mesh

type(parallel_map_t), intent(in) :: map

Parallel map

type(penalisation_t), intent(in) :: penalisation_cano

Penalisation (canonical)

type(penalisation_t), intent(in) :: penalisation_stag

Penalisation (staggered)

type(parallel_target_flux_t), intent(in) :: parflux_cano

Parallel target flux utility (canonical)

type(parallel_target_flux_t), intent(in) :: parflux_stag

Parallel target flux utility (staggered)

type(perp_bnd_flux_t), intent(in) :: perp_bnd_flux_cano

Perpendicular boundary flux utility (canonical)

type(perp_bnd_flux_t), intent(in) :: perp_bnd_flux_stag

Perpendicular boundary flux utility (staggered)

type(inplane_operators_t), intent(inout) :: opsinplane_cano

In-plane operators (canonical)

type(inplane_operators_t), intent(inout) :: opsinplane_stag

In-plane operators (staggered)

type(boundaries_neutrals_t), intent(inout) :: boundaries_neutrals

Boundary information for the NEUTRALS model

real(kind=GP), intent(in) :: tau

Time

type(variable_t), intent(in) :: ne

Plasma density at timestep t

type(variable_t), intent(in) :: pot

Electrostatic potential

type(variable_t), intent(inout) :: upar

Parallel ion velocity

type(variable_t), intent(inout) :: jpar

Parallel current

type(variable_t), intent(inout) :: apar_fluct

Fluctuation of apar used for flutter operators

type(variable_t), intent(in) :: te

Electron temperature at timestep t

type(variable_t), intent(in) :: ti

Ion temperature at timestep t

type(variable_t), intent(inout) :: neutrals_dens

Neutrals density, on input at t, on output advanced to t+1

type(variable_t), intent(inout) :: neutrals_parmom

Neutrals parallel momentum, on input at t, on output advanced to t+1

type(variable_t), intent(inout) :: neutrals_pressure

Neutrals pressure, on input at t, on output advanced to t+1

type(karniadakis_t), intent(inout) :: tstep_neutrals_dens

Time-step integrator for neutrals density

type(karniadakis_t), intent(inout) :: tstep_neutrals_parmom

Time-step integrator for neutrals parallel momentum

type(karniadakis_t), intent(inout) :: tstep_neutrals_pressure

Time-step integrator for neutrals pressure

integer, intent(out), dimension(4) :: sinfo

Info from elliptic solver

real(kind=GP), intent(out), dimension(4) :: res

Residual of solution of elliptic solver

logical, intent(out) :: success_neutrals

Success flag for timestep

public subroutine setup_implicit_solve(self, equi, mesh, penalisation, u, tstep_u, u_adv, u_bndval, diff_co, temperature_prefac, lambda, xi, co, rhs, apply_temperature_prefac)

Setup equation system for a neutrals diffusion equation on target variable u by setting lambda, xi, co, rhs coefficients in the helmholtz operator

Arguments

Type IntentOptional Attributes Name
class(neutrals_module_t), intent(in) :: self

Instance of class

class(equilibrium_t), intent(in) :: equi

Equilibrium

type(mesh_cart_t), intent(in) :: mesh

Mesh (any) within poloidal plane

type(penalisation_t), intent(in) :: penalisation

Penalisation (any)

real(kind=GP), intent(in), dimension(mesh%get_n_points()) :: u

Target variable values at timepoint t (i.e. before implicit solve)

type(karniadakis_t), intent(in) :: tstep_u

Timestepper object for target variable

real(kind=GP), intent(inout), dimension(mesh%get_n_points()) :: u_adv

RHS of implicit solve (e.g. obtained from prior timestepping on explicit components)

real(kind=GP), intent(in), dimension(mesh%get_n_points_boundary()) :: u_bndval

Boundary values of target variable

real(kind=GP), intent(in), dimension(mesh%get_n_points()) :: diff_co

Effective diffusion coefficient, excluding the jacobian

real(kind=GP), intent(in), dimension(mesh%get_n_points()) :: temperature_prefac

Temperature prefactor in lambda when solving for (u T) instead of (u)

real(kind=GP), intent(out), dimension(mesh%get_n_points_inner()) :: lambda

Output lambda

real(kind=GP), intent(out), dimension(mesh%get_n_points_inner()) :: xi

Output xi

real(kind=GP), intent(out), dimension(mesh%get_n_points()) :: co

Output co

real(kind=GP), intent(out), dimension(mesh%get_n_points()) :: rhs

Output rhs

logical, intent(in), optional :: apply_temperature_prefac

Switch whether or not to apply temperature prefactor (default: true) If true, assumes implicit solve is for (u T) instead of (u) and result of the solve must be divided by T to obtain u at time t+1

public subroutine neumann_mirror(self, equi, mesh, perp_bnd_flux, bnd_descrs_nmn, u, tstep_u, diff_co, temperature_prefac, lambda, xi, rhs, time_extrapolate, u_floor)

Apply "neumann mirroring", i.e. perpendicular neumann zero boundary condition in preparation for implicit solve of a neutrals equation

Arguments

Type IntentOptional Attributes Name
class(neutrals_module_t), intent(in) :: self

Instance of class

class(equilibrium_t), intent(in) :: equi

Equilibrium

type(mesh_cart_t), intent(in) :: mesh

Mesh (any) within poloidal plane

type(perp_bnd_flux_t), intent(in) :: perp_bnd_flux

Perpendicular boundary flux utility

integer, intent(in), dimension(mesh%get_n_points_boundary()) :: bnd_descrs_nmn

Boundary descriptors

real(kind=GP), intent(in), dimension(mesh%get_n_points()) :: u

Target variable values at timepoint t (i.e. before implicit solve)

type(karniadakis_t), intent(in) :: tstep_u

Timestepper object for target variable

real(kind=GP), intent(in), dimension(mesh%get_n_points()) :: diff_co

Effective diffusion coefficient, excluding the jacobian

real(kind=GP), intent(in), dimension(mesh%get_n_points()) :: temperature_prefac

Temperature prefactor in lambda when solving for (u T) instead of (u)

real(kind=GP), intent(inout), dimension(mesh%get_n_points_inner()) :: lambda

Lambda values, some of which will be overwritten at boundary polygon points

real(kind=GP), intent(inout), dimension(mesh%get_n_points_inner()) :: xi

Xi values, some of which will be overwritten at boundary polygon points

real(kind=GP), intent(inout), dimension(mesh%get_n_points()) :: rhs

Rhs values, some of which will be overwritten at boundary polygon points

logical, intent(in) :: time_extrapolate

Switch whether or not to use time extrapolation to mirror values at t+1

real(kind=GP), intent(in), optional :: u_floor

Optional floor to apply when time extrapolating, only used if time_extrapolate = T