Report Typos and Errors    
Semi-Lagrangian Library
Modular library for kinetic and gyrokinetic simulations of plasmas in fusion energy devices.
Derived types and interfaces | Functions/Subroutines
sll_m_maxwell_3d_trafo Module Reference

Description

Module interface to solve Maxwell's equations with coordinate transformation in 3D.

Author
Benedikt Perse

Derived types and interfaces

type  sll_t_maxwell_3d_trafo
 

Functions/Subroutines

subroutine sll_s_compute_e_from_b_3d_trafo (self, delta_t, field_in, field_out)
 compute E from B using weak Ampere formulation More...
 
subroutine sll_s_compute_b_from_e_3d_trafo (self, delta_t, field_in, field_out)
 Compute B from E using strong 3D Faraday equation for spline coefficients. More...
 
subroutine sll_s_compute_curl_part_3d_trafo (self, delta_t, efield, bfield, betar)
 Solve curl part of Maxwell's equations. More...
 
subroutine sll_s_compute_e_from_rho_3d_trafo (self, field_in, field_out)
 Compute E_i from rho_i integrated over the time interval using weak Poisson's equation. More...
 
subroutine sll_s_compute_rho_from_e_3d_trafo (self, field_in, field_out)
 compute rho from e using weak Gauss law ( rho = G^T M_1 e ) More...
 
subroutine sll_s_compute_e_from_j_3d_trafo (self, current, E, component)
 Compute E_i from j_i integrated over the time interval using weak Ampere formulation, delta_t is already included. More...
 
subroutine sll_s_compute_phi_from_rho_3d_trafo (self, field_in, field_out, efield_dofs)
 Compute phi from rho_i integrated over the time interval. More...
 
subroutine sll_s_compute_phi_from_j_3d_trafo (self, field_in, field_out, efield_dofs)
 Compute phi from j_i integrated over the time interval, delta_t is already included. More...
 
subroutine sll_s_compute_rhs_trafo (self, form, component, coefs_dofs, func1, func2, func3)
 Compute the FEM right-hand-side for a given function f and periodic splines of given degree Its components are $\int f(F(\xi)) N_i(F(\xi)) J_F d\xi$ where $N_i$ is the B-spline starting at $\xi_i$. More...
 
subroutine rhs_zeroform (self, deg, func, coefs_dofs)
 Compute $\int f(F(\xi)) N_i(\xi) J_F(\xi) d\xi$ for scalar function f, where $N_i$ is the B-spline starting at $\xi_i$, replace modulo(a,b) by a-floor(a/b)*b. More...
 
subroutine rhs_oneform (self, deg, func1, func2, func3, component, coefs_dofs)
 Compute $\int f(F(\xi))\cdot DF^{-T}(\xi) N_i(\xi) J_F(\xi) d\xi$ for vector function f, where $N_i$ is the B-spline starting at $\xi_i$. More...
 
subroutine rhs_twoform (self, deg, func1, func2, func3, component, coefs_dofs)
 Compute $\int f(F(\xi))\cdot DF(\xi) N_i(\xi) d\xi$ for vector function f, where $N_i$ is the B-spline starting at $\xi_i$. More...
 
subroutine rhs_threeform (self, deg, func, coefs_dofs)
 Compute $\int f(F(\xi)) N_i(\xi) d\xi$ for scalar function f, where $N_i$ is the B-spline starting at $\xi_i$. More...
 
subroutine l2projection_3d_trafo (self, form, component, coefs_dofs, func1, func2, func3)
 Compute the L2 projection of a given function f on periodic splines of given degree. More...
 
real(kind=f64) function l2norm_squared_3d_trafo (self, coefs, form, component)
 Compute square of the L2norm. More...
 
real(kind=f64) function inner_product_3d_trafo (self, coefs1, coefs2, form, component)
 Compute inner product. More...
 
subroutine init_3d_trafo (self, domain, n_dofs, s_deg_0, map, mass_tolerance, poisson_tolerance, solver_tolerance, adiabatic_electrons, profile)
 Initialization. More...
 
subroutine init_from_file_3d_trafo (self, domain, n_dofs, s_deg_0, map, nml_file, adiabatic_electrons, profile)
 Initialization from nml file. More...
 
subroutine free_3d_trafo (self)
 Finalization. More...
 
subroutine multiply_g (self, field_in, field_out)
 Multiply by dicrete gradient matrix. More...
 
subroutine multiply_gt (self, field_in, field_out)
 Multiply by transpose of dicrete gradient matrix. More...
 
subroutine multiply_c (self, field_in, field_out)
 Multiply by discrete curl matrix. More...
 
subroutine multiply_ct (self, field_in, field_out)
 Multiply by transpose of discrete curl matrix. More...
 
subroutine multiply_mass_trafo (self, deg, coefs_in, coefs_out)
 Multiply by the mass matrix. More...
 
subroutine multiply_mass_inverse_trafo (self, form, coefs_in, coefs_out)
 Multiply by the inverse mass matrix. More...
 

Function/Subroutine Documentation

◆ free_3d_trafo()

subroutine sll_m_maxwell_3d_trafo::free_3d_trafo ( class(sll_t_maxwell_3d_trafo self)
private

Finalization.

Parameters
selfMaxwell solver class

Definition at line 1052 of file sll_m_maxwell_3d_trafo.F90.

◆ init_3d_trafo()

subroutine sll_m_maxwell_3d_trafo::init_3d_trafo ( class(sll_t_maxwell_3d_trafo), intent(inout)  self,
real(kind=f64), dimension(3,2), intent(in)  domain,
integer(kind=i32), dimension(3), intent(in)  n_dofs,
integer(kind=i32), dimension(3), intent(in)  s_deg_0,
type(sll_t_mapping_3d), intent(inout), target  map,
real(kind=f64), intent(in), optional  mass_tolerance,
real(kind=f64), intent(in), optional  poisson_tolerance,
real(kind=f64), intent(in), optional  solver_tolerance,
logical, intent(in), optional  adiabatic_electrons,
type(sll_t_profile_functions), intent(in), optional  profile 
)
private

Initialization.

Parameters
[in,out]selfMaxwell solver class
[in]n_dofsnumber of degrees of freedom (here number of cells and grid points)
[in]s_deg_0highest spline degree
[in,out]mapcoordinate transformation
[in]mass_tolerancetolerance for mass solver
[in]poisson_tolerancetolerance for Poisson solver
[in]solver_tolerancetolerance for Schur complement solver
[in]adiabatic_electronsflag if adiabatic electrons are used
[in]profiletemperature and density profiles

Definition at line 749 of file sll_m_maxwell_3d_trafo.F90.

Here is the call graph for this function:

◆ init_from_file_3d_trafo()

subroutine sll_m_maxwell_3d_trafo::init_from_file_3d_trafo ( class(sll_t_maxwell_3d_trafo), intent(inout)  self,
real(kind=f64), dimension(3,2), intent(in)  domain,
integer(kind=i32), dimension(3), intent(in)  n_dofs,
integer(kind=i32), dimension(3), intent(in)  s_deg_0,
type(sll_t_mapping_3d), intent(inout), target  map,
character(len=*), intent(in)  nml_file,
logical, intent(in), optional  adiabatic_electrons,
type(sll_t_profile_functions), intent(in), optional  profile 
)
private

Initialization from nml file.

Parameters
[in,out]selfMaxwell solver class
[in]n_dofsnumber of degrees of freedom (here number of cells and grid points)
[in]s_deg_0highest spline degree
[in,out]mapcoordinate transformation
[in]nml_filenml-file
[in]adiabatic_electronsflag if adiabatic electrons are used
[in]profiletemperature and density profiles

Definition at line 971 of file sll_m_maxwell_3d_trafo.F90.

Here is the call graph for this function:

◆ inner_product_3d_trafo()

real(kind=f64) function sll_m_maxwell_3d_trafo::inner_product_3d_trafo ( class(sll_t_maxwell_3d_trafo self,
real(kind=f64), dimension(:)  coefs1,
real(kind=f64), dimension(:)  coefs2,
integer(kind=i32)  form,
integer(kind=i32), optional  component 
)
private

Compute inner product.

Parameters
selfMaxwell solver class
coefs1Coefficient for each DoF
coefs2Coefficient for each DoF
formSpecify 0,1,2 or 3-form
componentSpecify the component of the form
Returns
Result: squared L2 norm

Definition at line 719 of file sll_m_maxwell_3d_trafo.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ l2norm_squared_3d_trafo()

real(kind=f64) function sll_m_maxwell_3d_trafo::l2norm_squared_3d_trafo ( class(sll_t_maxwell_3d_trafo self,
real(kind=f64), dimension(:)  coefs,
integer(kind=i32)  form,
integer(kind=i32)  component 
)
private

Compute square of the L2norm.

Parameters
selfMaxwell solver class
coefsCoefficient for each DoF
formSpecify 0,1,2 or 3-form
componentSpecify the component of the form
Returns
Result: squared L2 norm

Definition at line 706 of file sll_m_maxwell_3d_trafo.F90.

Here is the call graph for this function:

◆ l2projection_3d_trafo()

subroutine sll_m_maxwell_3d_trafo::l2projection_3d_trafo ( class(sll_t_maxwell_3d_trafo self,
integer(kind=i32), intent(in)  form,
integer(kind=i32), intent(in)  component,
real(kind=f64), dimension(:), intent(out)  coefs_dofs,
procedure(sll_i_function_3d_real64 func1,
procedure(sll_i_function_3d_real64), optional  func2,
procedure(sll_i_function_3d_real64), optional  func3 
)
private

Compute the L2 projection of a given function f on periodic splines of given degree.

Parameters
selfMaxwell solver class
[in]formSpecify if the function is a0,1,2 or 3-form
[in]componentSpecify the component of the function
[out]coefs_dofsFinite Element right-hand-side
func1Function first component
func2Function second component
func3Function third component

Definition at line 668 of file sll_m_maxwell_3d_trafo.F90.

Here is the call graph for this function:

◆ multiply_c()

subroutine sll_m_maxwell_3d_trafo::multiply_c ( class(sll_t_maxwell_3d_trafo self,
real(kind=f64), dimension(:), intent(in)  field_in,
real(kind=f64), dimension(:), intent(out)  field_out 
)
private

Multiply by discrete curl matrix.

Parameters
selfMaxwell solver class
[out]field_outC*field_in

Definition at line 1096 of file sll_m_maxwell_3d_trafo.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ multiply_ct()

subroutine sll_m_maxwell_3d_trafo::multiply_ct ( class(sll_t_maxwell_3d_trafo self,
real(kind=f64), dimension(:), intent(in)  field_in,
real(kind=f64), dimension(:), intent(out)  field_out 
)
private

Multiply by transpose of discrete curl matrix.

Parameters
selfMaxwell solver class
[out]field_outC^T*field_in

Definition at line 1107 of file sll_m_maxwell_3d_trafo.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ multiply_g()

subroutine sll_m_maxwell_3d_trafo::multiply_g ( class(sll_t_maxwell_3d_trafo self,
real(kind=f64), dimension(:), intent(in)  field_in,
real(kind=f64), dimension(:), intent(out)  field_out 
)
private

Multiply by dicrete gradient matrix.

Parameters
selfMaxwell solver class
[out]field_outG*field_in

Definition at line 1074 of file sll_m_maxwell_3d_trafo.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ multiply_gt()

subroutine sll_m_maxwell_3d_trafo::multiply_gt ( class(sll_t_maxwell_3d_trafo self,
real(kind=f64), dimension(:), intent(in)  field_in,
real(kind=f64), dimension(:), intent(out)  field_out 
)
private

Multiply by transpose of dicrete gradient matrix.

Parameters
selfMaxwell solver class
[out]field_outG^T*field_in

Definition at line 1085 of file sll_m_maxwell_3d_trafo.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ multiply_mass_inverse_trafo()

subroutine sll_m_maxwell_3d_trafo::multiply_mass_inverse_trafo ( class(sll_t_maxwell_3d_trafo self,
integer(kind=i32), intent(in)  form,
real(kind=f64), dimension(:), intent(in)  coefs_in,
real(kind=f64), dimension(:), intent(out)  coefs_out 
)
private

Multiply by the inverse mass matrix.

Parameters
selfMaxwell solver class
[in]formform specifies the form (Note: 0 for 0-form, 1 for 1-form, 2 for 2-form, 3 for 0-1-form mix)
[out]coefs_outM^{-1}*coefs_in

Definition at line 1145 of file sll_m_maxwell_3d_trafo.F90.

◆ multiply_mass_trafo()

subroutine sll_m_maxwell_3d_trafo::multiply_mass_trafo ( class(sll_t_maxwell_3d_trafo self,
integer(kind=i32), dimension(:), intent(in)  deg,
real(kind=f64), dimension(:), intent(in)  coefs_in,
real(kind=f64), dimension(:), intent(out)  coefs_out 
)
private

Multiply by the mass matrix.

Parameters
selfMaxwell solver class
[in]degdeg/form specifies if we multiply the mass to a 1- or 2-form or a mix of both
[out]coefs_outM*coefs_in

Definition at line 1118 of file sll_m_maxwell_3d_trafo.F90.

Here is the caller graph for this function:

◆ rhs_oneform()

subroutine sll_m_maxwell_3d_trafo::rhs_oneform ( class(sll_t_maxwell_3d_trafo self,
integer(kind=i32), dimension(3), intent(in)  deg,
procedure(sll_i_function_3d_real64 func1,
procedure(sll_i_function_3d_real64 func2,
procedure(sll_i_function_3d_real64 func3,
integer(kind=i32), intent(in)  component,
real(kind=f64), dimension(:), intent(out)  coefs_dofs 
)
private

Compute $\int f(F(\xi))\cdot DF^{-T}(\xi) N_i(\xi) J_F(\xi) d\xi$ for vector function f, where $N_i$ is the B-spline starting at $\xi_i$.

Parameters
selfMaxwell solver class
[in]degspline degree
func1Function first component
func2Function second component
func3Function third component
[in]componentSpecify the component of the function
[out]coefs_dofsFinite Element right-hand-side

Definition at line 409 of file sll_m_maxwell_3d_trafo.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rhs_threeform()

subroutine sll_m_maxwell_3d_trafo::rhs_threeform ( class(sll_t_maxwell_3d_trafo self,
integer(kind=i32), dimension(3), intent(in)  deg,
procedure(sll_i_function_3d_real64 func,
real(kind=f64), dimension(:), intent(out)  coefs_dofs 
)
private

Compute $\int f(F(\xi)) N_i(\xi) d\xi$ for scalar function f, where $N_i$ is the B-spline starting at $\xi_i$.

Parameters
selfMaxwell solver class
[in]degspline degree
funcFunction
[out]coefs_dofsFinite Element right-hand-side

Definition at line 589 of file sll_m_maxwell_3d_trafo.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rhs_twoform()

subroutine sll_m_maxwell_3d_trafo::rhs_twoform ( class(sll_t_maxwell_3d_trafo self,
integer(kind=i32), dimension(3), intent(in)  deg,
procedure(sll_i_function_3d_real64 func1,
procedure(sll_i_function_3d_real64 func2,
procedure(sll_i_function_3d_real64 func3,
integer(kind=i32), intent(in)  component,
real(kind=f64), dimension(:), intent(out)  coefs_dofs 
)
private

Compute $\int f(F(\xi))\cdot DF(\xi) N_i(\xi) d\xi$ for vector function f, where $N_i$ is the B-spline starting at $\xi_i$.

Parameters
selfMaxwell solver class
[in]degspline degree
func1Function first component
func2Function second component
func3Function third component
[in]componentSpecify the component of the function
[out]coefs_dofsFinite Element right-hand-side

Definition at line 499 of file sll_m_maxwell_3d_trafo.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rhs_zeroform()

subroutine sll_m_maxwell_3d_trafo::rhs_zeroform ( class(sll_t_maxwell_3d_trafo self,
integer(kind=i32), dimension(3), intent(in)  deg,
procedure(sll_i_function_3d_real64 func,
real(kind=f64), dimension(:), intent(out)  coefs_dofs 
)
private

Compute $\int f(F(\xi)) N_i(\xi) J_F(\xi) d\xi$ for scalar function f, where $N_i$ is the B-spline starting at $\xi_i$, replace modulo(a,b) by a-floor(a/b)*b.

Parameters
selfMaxwell solver class
[in]degspline degree
funcfunction
[out]coefs_dofsFinite Element right-hand-side

Definition at line 326 of file sll_m_maxwell_3d_trafo.F90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sll_s_compute_b_from_e_3d_trafo()

subroutine sll_m_maxwell_3d_trafo::sll_s_compute_b_from_e_3d_trafo ( class(sll_t_maxwell_3d_trafo self,
real(kind=f64), intent(in)  delta_t,
real(kind=f64), dimension(:), intent(in)  field_in,
real(kind=f64), dimension(:), intent(inout)  field_out 
)
private

Compute B from E using strong 3D Faraday equation for spline coefficients.

Parameters
selfMaxwell solver class
[in]delta_tTime step
[in]field_inE
[in,out]field_outB

Definition at line 168 of file sll_m_maxwell_3d_trafo.F90.

Here is the call graph for this function:

◆ sll_s_compute_curl_part_3d_trafo()

subroutine sll_m_maxwell_3d_trafo::sll_s_compute_curl_part_3d_trafo ( class(sll_t_maxwell_3d_trafo self,
intent(in)  delta_t,
dimension(:), intent(inout)  efield,
dimension(:), intent(inout)  bfield,
optional  betar 
)
private

Solve curl part of Maxwell's equations.

Parameters
selfMaxwell solver class

Definition at line 182 of file sll_m_maxwell_3d_trafo.F90.

◆ sll_s_compute_e_from_b_3d_trafo()

subroutine sll_m_maxwell_3d_trafo::sll_s_compute_e_from_b_3d_trafo ( class(sll_t_maxwell_3d_trafo self,
real(kind=f64), intent(in)  delta_t,
real(kind=f64), dimension(:), intent(in)  field_in,
real(kind=f64), dimension(:), intent(inout)  field_out 
)
private

compute E from B using weak Ampere formulation

Parameters
selfMaxwell solver class
[in]delta_tTime step
[in]field_inB
[in,out]field_outE

Definition at line 150 of file sll_m_maxwell_3d_trafo.F90.

Here is the call graph for this function:

◆ sll_s_compute_e_from_j_3d_trafo()

subroutine sll_m_maxwell_3d_trafo::sll_s_compute_e_from_j_3d_trafo ( class(sll_t_maxwell_3d_trafo self,
real(kind=f64), dimension(:), intent(in)  current,
real(kind=f64), dimension(:), intent(inout)  E,
integer(kind=i32), intent(in), optional  component 
)
private

Compute E_i from j_i integrated over the time interval using weak Ampere formulation, delta_t is already included.

Parameters
selfMaxwell solver class
[in]currentCurrent integrated over time interval
[in,out]eUpdated electric field

Definition at line 249 of file sll_m_maxwell_3d_trafo.F90.

◆ sll_s_compute_e_from_rho_3d_trafo()

subroutine sll_m_maxwell_3d_trafo::sll_s_compute_e_from_rho_3d_trafo ( class(sll_t_maxwell_3d_trafo self,
real(kind=f64), dimension(:), intent(in)  field_in,
real(kind=f64), dimension(:), intent(out)  field_out 
)
private

Compute E_i from rho_i integrated over the time interval using weak Poisson's equation.

Parameters
selfMaxwell solver class
[in]field_inrho
[out]field_outE

Definition at line 221 of file sll_m_maxwell_3d_trafo.F90.

Here is the call graph for this function:

◆ sll_s_compute_phi_from_j_3d_trafo()

subroutine sll_m_maxwell_3d_trafo::sll_s_compute_phi_from_j_3d_trafo ( class(sll_t_maxwell_3d_trafo self,
real(kind=f64), dimension(:), intent(in)  field_in,
real(kind=f64), dimension(:), intent(inout)  field_out,
real(kind=f64), dimension(:), intent(out)  efield_dofs 
)
private

Compute phi from j_i integrated over the time interval, delta_t is already included.

Parameters
selfMaxwell solver class
[in]field_inCurrent integrated over time interval
[in,out]field_outphi
[out]efield_dofsE

Definition at line 276 of file sll_m_maxwell_3d_trafo.F90.

◆ sll_s_compute_phi_from_rho_3d_trafo()

subroutine sll_m_maxwell_3d_trafo::sll_s_compute_phi_from_rho_3d_trafo ( class(sll_t_maxwell_3d_trafo self,
real(kind=f64), dimension(:), intent(in)  field_in,
real(kind=f64), dimension(:), intent(inout)  field_out,
real(kind=f64), dimension(:), intent(out)  efield_dofs 
)
private

Compute phi from rho_i integrated over the time interval.

Parameters
selfMaxwell solver class
[in]field_inrho
[in,out]field_outphi
[out]efield_dofsE

Definition at line 262 of file sll_m_maxwell_3d_trafo.F90.

◆ sll_s_compute_rho_from_e_3d_trafo()

subroutine sll_m_maxwell_3d_trafo::sll_s_compute_rho_from_e_3d_trafo ( class(sll_t_maxwell_3d_trafo self,
real(kind=f64), dimension(:), intent(in)  field_in,
real(kind=f64), dimension(:), intent(out)  field_out 
)
private

compute rho from e using weak Gauss law ( rho = G^T M_1 e )

Parameters
selfMaxwell solver class
[in]field_inE
[out]field_outrho

Definition at line 234 of file sll_m_maxwell_3d_trafo.F90.

Here is the call graph for this function:

◆ sll_s_compute_rhs_trafo()

subroutine sll_m_maxwell_3d_trafo::sll_s_compute_rhs_trafo ( class(sll_t_maxwell_3d_trafo self,
integer(kind=i32), intent(in)  form,
integer(kind=i32), intent(in)  component,
real(kind=f64), dimension(:), intent(out)  coefs_dofs,
procedure(sll_i_function_3d_real64 func1,
procedure(sll_i_function_3d_real64), optional  func2,
procedure(sll_i_function_3d_real64), optional  func3 
)
private

Compute the FEM right-hand-side for a given function f and periodic splines of given degree Its components are $\int f(F(\xi)) N_i(F(\xi)) J_F d\xi$ where $N_i$ is the B-spline starting at $\xi_i$.

Parameters
selfMaxwell solver class
[in]formSpecify if the function is a0,1,2 or 3-form
[in]componentSpecify the component of the function
[out]coefs_dofsFinite Element right-hand-side
func1Function first component
func2Function second component
func3Function third component

Definition at line 294 of file sll_m_maxwell_3d_trafo.F90.

Here is the call graph for this function:
Here is the caller graph for this function:
    Report Typos and Errors