perp_bnd_flux_m Module

Module for computing perpendicular fluxes through domain



Contents


Interfaces

interface

  • public module subroutine init_perp_bnd_flux(self, equi, mesh, penalisation, dbgout)

    Creates perpendicular boundary polygons and conectivity matrices

    Arguments

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

    Instance of class

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

    Equilibrium

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

    Mesh

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

    Penalisation

    integer, intent(in), optional :: dbgout

    Debug output level

interface

  • public module subroutine write_netcdf_perp_bnd_flux(self, fgid)

    Writes boundary polygons to netcdf file

    Arguments

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

    Instance of class

    integer, intent(in) :: fgid

    File or group id

interface

  • public module subroutine read_netcdf_perp_bnd_flux(self, fgid)

    Reads boundary polygon information from netcdf file

    Arguments

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

    Instance of class

    integer, intent(in) :: fgid

    File or group id

interface

  • public module subroutine destructor(self)

    Destructor

    Arguments

    Type IntentOptional Attributes Name
    type(perp_bnd_flux_t), intent(inout) :: self

    Instance of type


Derived Types

type, public ::  perp_bnd_flux_t

Wrapper type for managing perpendicular fluxes

Components

Type Visibility Attributes Name Initial
type(polygon_in_mesh_t), public :: core

Polygon for core boundary

type(csrmat_t), public :: conn_core

Connectivity matrix for core polygon

type(polygon_in_mesh_t), public :: outer

Polygon for outer boundary This consists of the wall and dome excluding the part within the penalisation and the target

type(csrmat_t), public :: conn_outer

Connectivity matrix for outer polygon

type(polygon_in_mesh_t), public :: target

Polygon for target boundary

type(csrmat_t), public :: conn_target

Connectivity matrix for target polygon

integer, public, dimension(:), allocatable :: full_to_inner

Index map of full mesh indices to corresponding inner mesh index (if it exists) Full indices without associated inner index have value 0

Finalizations Procedures

final :: destructor

Type-Bound Procedures

procedure , public :: init => init_perp_bnd_flux Interface
procedure , public :: write_netcdf => write_netcdf_perp_bnd_flux Interface
procedure , public :: read_netcdf => read_netcdf_perp_bnd_flux Interface

Functions

public function get_diffusive_flux_total(comm_handler, polygon, diff_flux, sum_over_planes, iseg) result(res)

Computes total flux through polygon segment from diff_flux array, which has to be computed previously via compute_diffusive_flux.

Arguments

Type IntentOptional Attributes Name
type(comm_handler_t), intent(in) :: comm_handler

Communicators

type(polygon_in_mesh_t), intent(in) :: polygon

Polygon

real(kind=GP), intent(in), dimension(polygon%get_np_total()) :: diff_flux

Diffusive flux through boundary in between polygon points and its connected points obtained from compute_diffusive_flux

logical, intent(in) :: sum_over_planes

If true summation over planes is performed. This assumes that polygons have same structure over planes

integer, intent(in), optional :: iseg

Segment for which flux is computed. If not present then flux summed over all segments is returned

Return Value real(kind=GP)

public function get_diffusive_flux_local(polygon, diff_flux, ks, iseg) result(res)

Computes local flux through polygon point (area associated with polygon point) diff_flux array has to be computed previously via compute_diffusive_flux

Arguments

Type IntentOptional Attributes Name
type(polygon_in_mesh_t), intent(in) :: polygon

Polygon

real(kind=GP), intent(in), dimension(polygon%get_np_total()) :: diff_flux

Diffusive flux through boundary in between polygon points and its connected points obtained from compute_diffusive_flux

integer, intent(in) :: ks

Index on polygon segment If index does not exist on segment, zero flux is returned

integer, intent(in), optional :: iseg

Segment for which flux is computed, default = 1

Return Value real(kind=GP)

public function get_drift_flux_total(comm_handler, polygon, drift_flux, sum_over_planes, iseg) result(res)

Computes total flux through polygon segment from drift_flux array, which has to be computed previously via compute_drift_flux. $omp parallel default(none) private(is, ks, ks_glob) & $omp shared(polygon, iseg_start, iseg_end, nexclude_last, drift_flux, res) $omp do reduction(+ : res) $omp end do $omp end parallel

Arguments

Type IntentOptional Attributes Name
type(comm_handler_t), intent(in) :: comm_handler

Communicators

type(polygon_in_mesh_t), intent(in) :: polygon

Polygon

real(kind=GP), intent(in), dimension(polygon%get_np_total()) :: drift_flux

Drift flux through boundary in between polygon points, obtained via compute_drift_flux routine

logical, intent(in) :: sum_over_planes

If true summation over planes is performed. This assumes that polygons have same structure over planes

integer, intent(in), optional :: iseg

Segment for which flux is computed. If not present then flux summed over all segments is returned

Return Value real(kind=GP)

public function get_drift_flux_local(polygon, drift_flux, ks, iseg) result(res)

Computes local flux through polygon point (area associated with polygon point) drift_flux array has to be computed previously via compute_drift_flux

Arguments

Type IntentOptional Attributes Name
type(polygon_in_mesh_t), intent(in) :: polygon

Polygon

real(kind=GP), intent(in), dimension(polygon%get_np_total()) :: drift_flux

Drift flux through boundary in between polygon points, obtained via compute_drift_flux routine

integer, intent(in) :: ks

Index on polygon segment If index does not exist on segment, zero flux is returned

integer, intent(in), optional :: iseg

Segment for which flux is computed, default = 1

Return Value real(kind=GP)


Subroutines

public subroutine mirrorset_polyperpbnd_points(equi, mesh, polygon, conn, u, co, iseg)

Sets points of field u on boundary-polygon to the value of its connected inner points, according to connectivity matrix conn.

Arguments

Type IntentOptional Attributes Name
class(equilibrium_t), intent(in) :: equi

Equilibrium

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

Mesh

type(polygon_in_mesh_t), intent(in) :: polygon

Polygon

type(csrmat_t), intent(in) :: conn

Connectivity matrix

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

Field

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

Coefficient

integer, intent(in), optional :: iseg

Segment for which miroring is applied. By default it is applied to all segments.

public subroutine compute_diffusive_flux(equi, mesh, dphi, polygon, conn, u, diff_flux, co)

Computes the diffusive flux through a perpendicular boundary polygon, i.e. \int_S v \nabla u dS, where nabla is gradient within plane Sign convention is that flux out of inner domain is positive

Arguments

Type IntentOptional Attributes Name
class(equilibrium_t), intent(in) :: equi

Equilibrium

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

Mesh

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

Toroidal extent of surface

type(polygon_in_mesh_t), intent(in) :: polygon

Polygon

type(csrmat_t), intent(in) :: conn

Connectivity matrix

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

Field

real(kind=GP), intent(out), dimension(polygon%get_np_total()) :: diff_flux

Diffusive flux through boundary polygon points (its associated area)

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

Coefficient

public subroutine compute_drift_flux(equi, equi_storage, mesh, dphi, polygon, u, drift_flux, v)

Computes fluxes due to drift through a toroidally extended polygon \int_S v * (B/B^2 \times \nabla u) dS The integrand can be expressed via a derivative along the polygon \int v * 1/Btor du/dl J dl dphi where l measures the length along the polygon $omp parallel default(none) & $omp private(iseg, ks, ks_glob, l, lfwd, x, y, xfwd, yfwd, & $omp jac_av, btor_av, v_av) & $omp shared(equi, equi_storage, mesh, dphi, polygon, phi, nexclude_last, & $omp u, v, drift_flux) $omp do $omp end do $omp end parallel

Arguments

Type IntentOptional Attributes Name
class(equilibrium_t), intent(in) :: equi

Equilibrium

type(equilibrium_storage_t), intent(in) :: equi_storage

Equilibrium on mesh

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

Mesh

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

Toroidal extent of surface

type(polygon_in_mesh_t), intent(in) :: polygon

Polygon

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

Field

real(kind=GP), intent(out), dimension(polygon%get_np_total()) :: drift_flux

Drift flux through boundary in between polygon points This quantity is difficult to interpret, use the getter routines ... to compute the local or integrated fluxes

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

Optional field, default values 1