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_1d_fem_sm Module Reference

Description

Solve Maxwell's equations in 1D based on spline FEM, version based on sparse matrices.

Author
Katharina Kormann, Benedikt Perse

Derived types and interfaces

type  sll_t_maxwell_1d_fem_sm
 Maxwell solver class for spline FEM with sparse matrix solvers. More...
 

Functions/Subroutines

subroutine sll_s_compute_e_from_b_1d_fem_sm (self, delta_t, field_in, field_out)
 compute Ey from Bz using weak Ampere formulation More...
 
subroutine sll_s_compute_b_from_e_1d_fem_sm (self, delta_t, field_in, field_out)
 Compute Bz from Ey using strong 1D Faraday equation for spline coefficients $B_z^{new}(x_j) = B_z^{old}(x_j) - \frac{\Delta t}{\Delta x} (E_y(x_j) - E_y(x_{j-1}) $. More...
 
subroutine sll_s_compute_curl_part_1d_fem_sm (self, delta_t, efield, bfield, betar)
 Solve curl part of Maxwell's equations. More...
 
subroutine sll_s_compute_e_from_rho_1d_fem_sm (self, field_in, field_out)
 compute e from rho using weak Poisson's equation ( rho = G^T M_1 G \phi, e = G \phi ) More...
 
subroutine compute_rho_from_e_1d_fem_sm (self, field_in, field_out)
 Compute rho from Gauss law for given efield. More...
 
subroutine compute_e_from_j_1d_fem_sm (self, current, component, E)
 Compute E_i from j_i integrated over the time interval using weak Ampere formulation. More...
 
subroutine compute_phi_from_rho_1d_fem_sm (self, in, phi, efield)
 For model with adiabatic electrons. More...
 
subroutine compute_phi_from_j_1d_fem_sm (self, in, phi, efield)
 For model with adiabatic electrons. More...
 
subroutine sll_s_compute_rhs_fem_sm (self, func, degree, coefs_dofs)
 Compute the FEM right-hand-side for a given function f and periodic splines of given degree Its components are $\int f N_i dx$ where $N_i$ is the B-spline starting at $x_i$. More...
 
subroutine l2projection_1d_fem_sm (self, func, degree, coefs_dofs)
 Compute the L2 projection of a given function f on periodic splines of given degree. More...
 
real(kind=f64) function l2norm_squared_1d_fem_sm (self, coefs_dofs, degree)
 Compute square of the L2norm. More...
 
real(kind=f64) function inner_product_1d_fem_sm (self, coefs1_dofs, coefs2_dofs, degree, degree2)
 Compute inner product. More...
 
subroutine init_1d_fem_sm (self, domain, n_dofs, s_deg_0, delta_t, mass_tolerance, poisson_tolerance, solver_tolerance, force_sign, adiabatic_electrons)
 Initialization. More...
 
subroutine init_from_file_1d_fem_sm (self, domain, n_dofs, s_deg_0, nml_file, force_sign, adiabatic_electrons)
 Initialization from nml file. More...
 
subroutine free_1d_fem_sm (self)
 Finalization. More...
 
subroutine multiply_g (self, in, out)
 Multiply by dicrete gradient matrix. More...
 
subroutine multiply_gt (self, in, out)
 Multiply by transpose of dicrete gradient matrix. More...
 
subroutine multiply_mass_1d_fem_sm (self, in, out, degree)
 Multiply by the mass matrix. More...
 
subroutine invert_mass_1d_fem_sm (self, in, out, degree)
 Multiply by the inverse mass matrix. More...
 

Function/Subroutine Documentation

◆ compute_e_from_j_1d_fem_sm()

subroutine sll_m_maxwell_1d_fem_sm::compute_e_from_j_1d_fem_sm ( class(sll_t_maxwell_1d_fem_sm self,
real(kind=f64), dimension(:), intent(in)  current,
integer(kind=i32), intent(in)  component,
real(kind=f64), dimension(:), intent(inout)  E 
)
private

Compute E_i from j_i integrated over the time interval using weak Ampere formulation.

Parameters
selfMaxwell solver class
[in]currentComponent component of the current integrated over time interval
[in]componentComponent of the Efield to be computed
[in,out]eUpdated electric field

Definition at line 233 of file sll_m_maxwell_1d_fem_sm.F90.

◆ compute_phi_from_j_1d_fem_sm()

subroutine sll_m_maxwell_1d_fem_sm::compute_phi_from_j_1d_fem_sm ( class(sll_t_maxwell_1d_fem_sm self,
real(kind=f64), dimension(:), intent(in)  in,
real(kind=f64), dimension(:), intent(out)  phi,
real(kind=f64), dimension(:), intent(out)  efield 
)
private

For model with adiabatic electrons.

Parameters
selfMaxwell solver class
[in]inCurrent integrated over time interval
[out]efieldE

Definition at line 272 of file sll_m_maxwell_1d_fem_sm.F90.

Here is the call graph for this function:

◆ compute_phi_from_rho_1d_fem_sm()

subroutine sll_m_maxwell_1d_fem_sm::compute_phi_from_rho_1d_fem_sm ( class(sll_t_maxwell_1d_fem_sm self,
real(kind=f64), dimension(:), intent(in)  in,
real(kind=f64), dimension(:), intent(out)  phi,
real(kind=f64), dimension(:), intent(out)  efield 
)
private

For model with adiabatic electrons.

Parameters
selfMaxwell solver class
[in]inrho
[out]efieldE

Definition at line 255 of file sll_m_maxwell_1d_fem_sm.F90.

Here is the call graph for this function:

◆ compute_rho_from_e_1d_fem_sm()

subroutine sll_m_maxwell_1d_fem_sm::compute_rho_from_e_1d_fem_sm ( class(sll_t_maxwell_1d_fem_sm self,
real(kind=f64), dimension(:), intent(in)  field_in,
real(kind=f64), dimension(:), intent(out)  field_out 
)
private

Compute rho from Gauss law for given efield.

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

Definition at line 220 of file sll_m_maxwell_1d_fem_sm.F90.

Here is the call graph for this function:

◆ free_1d_fem_sm()

subroutine sll_m_maxwell_1d_fem_sm::free_1d_fem_sm ( class(sll_t_maxwell_1d_fem_sm self)
private

Finalization.

Parameters
selfMaxwell solver class

Definition at line 608 of file sll_m_maxwell_1d_fem_sm.F90.

◆ init_1d_fem_sm()

subroutine sll_m_maxwell_1d_fem_sm::init_1d_fem_sm ( class(sll_t_maxwell_1d_fem_sm), intent(out)  self,
real(kind=f64), dimension(2), intent(in)  domain,
integer(kind=i32), intent(in)  n_dofs,
integer(kind=i32), intent(in)  s_deg_0,
real(kind=f64), intent(in)  delta_t,
real(kind=f64), intent(in), optional  mass_tolerance,
real(kind=f64), intent(in), optional  poisson_tolerance,
real(kind=f64), intent(in), optional  solver_tolerance,
real(kind=f64), intent(in), optional  force_sign,
logical, intent(in), optional  adiabatic_electrons 
)
private

Initialization.

Parameters
[out]selfMaxwell solver class
[in]domainxmin, xmax
[in]n_dofsnumber of degrees of freedom (here number of cells and grid points)
[in]s_deg_0highest spline degree
[in]delta_tTime step
[in]mass_tolerancetolerance for mass solver
[in]poisson_tolerancetolerance for Poisson solver
[in]solver_tolerancetolerance for Schur complement solver
[in]force_signsign of particle force
[in]adiabatic_electronsflag if adiabatic electrons are used

Definition at line 425 of file sll_m_maxwell_1d_fem_sm.F90.

Here is the call graph for this function:

◆ init_from_file_1d_fem_sm()

subroutine sll_m_maxwell_1d_fem_sm::init_from_file_1d_fem_sm ( class(sll_t_maxwell_1d_fem_sm), intent(out)  self,
real(kind=f64), dimension(2), intent(in)  domain,
integer(kind=i32), intent(in)  n_dofs,
integer(kind=i32), intent(in)  s_deg_0,
character(len=*)  nml_file,
real(kind=f64), intent(in), optional  force_sign,
logical, intent(in), optional  adiabatic_electrons 
)
private

Initialization from nml file.

Parameters
[out]selfMaxwell solver class
[in]domainxmin, xmax
[in]n_dofsnumber of degrees of freedom (here number of cells and grid points)
[in]s_deg_0highest spline degree
nml_filenml-file
[in]force_signsign of particle force
[in]adiabatic_electronsflag if adiabatic electrons are used

Definition at line 527 of file sll_m_maxwell_1d_fem_sm.F90.

Here is the call graph for this function:

◆ inner_product_1d_fem_sm()

real(kind=f64) function sll_m_maxwell_1d_fem_sm::inner_product_1d_fem_sm ( class(sll_t_maxwell_1d_fem_sm self,
real(kind=f64), dimension(:)  coefs1_dofs,
real(kind=f64), dimension(:)  coefs2_dofs,
integer(kind=i32)  degree,
integer(kind=i32), optional  degree2 
)
private

Compute inner product.

Parameters
selfMaxwell solver class
coefs1_dofsCoefficient for each DoF
coefs2_dofsCoefficient for each DoF
degreeSpecify the degree of the basis functions
degree2Specify the degree of the basis functions
Returns
Result: squared L2 norm

Definition at line 375 of file sll_m_maxwell_1d_fem_sm.F90.

◆ invert_mass_1d_fem_sm()

subroutine sll_m_maxwell_1d_fem_sm::invert_mass_1d_fem_sm ( class(sll_t_maxwell_1d_fem_sm), intent(inout)  self,
real(kind=f64), dimension(:), intent(in)  in,
real(kind=f64), dimension(:), intent(out)  out,
integer(kind=i32), intent(in)  degree 
)
private

Multiply by the inverse mass matrix.

Parameters
[in,out]selfMaxwell solver class
[in]inCoefficient for each DoF
[out]outCoefficient for each DoF
[in]degreeSpecify the degree of the basis functions

Definition at line 664 of file sll_m_maxwell_1d_fem_sm.F90.

◆ l2norm_squared_1d_fem_sm()

real(kind=f64) function sll_m_maxwell_1d_fem_sm::l2norm_squared_1d_fem_sm ( class(sll_t_maxwell_1d_fem_sm self,
real(kind=f64), dimension(:)  coefs_dofs,
integer(kind=i32)  degree 
)
private

Compute square of the L2norm.

Parameters
selfMaxwell solver class
coefs_dofsCoefficient for each DoF
degreeSpecify the degree of the basis functions
Returns
Result: squared L2 norm

Definition at line 355 of file sll_m_maxwell_1d_fem_sm.F90.

◆ l2projection_1d_fem_sm()

subroutine sll_m_maxwell_1d_fem_sm::l2projection_1d_fem_sm ( class(sll_t_maxwell_1d_fem_sm self,
procedure(sll_i_function_1d_real64 func,
integer(kind=i32), intent(in)  degree,
real(kind=f64), dimension(:), intent(out)  coefs_dofs 
)
private

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

Parameters
selfMaxwell solver class
funcfunction
[in]degreeSpecify the degree of the basis functions
[out]coefs_dofsspline coefficients of projection

Definition at line 332 of file sll_m_maxwell_1d_fem_sm.F90.

Here is the call graph for this function:

◆ multiply_g()

subroutine sll_m_maxwell_1d_fem_sm::multiply_g ( class(sll_t_maxwell_1d_fem_sm), intent(in)  self,
real(kind=f64), dimension(:), intent(in)  in,
real(kind=f64), dimension(:), intent(out)  out 
)
private

Multiply by dicrete gradient matrix.

Parameters
[in]selfMaxwell solver class
[in]infield_in
[out]outG*field_in

Definition at line 620 of file sll_m_maxwell_1d_fem_sm.F90.

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

◆ multiply_gt()

subroutine sll_m_maxwell_1d_fem_sm::multiply_gt ( class(sll_t_maxwell_1d_fem_sm), intent(in)  self,
real(kind=f64), dimension(:), intent(in)  in,
real(kind=f64), dimension(:), intent(out)  out 
)
private

Multiply by transpose of dicrete gradient matrix.

Parameters
[in]selfMaxwell solver class
[in]infield_in
[out]outG^T*field_in

Definition at line 631 of file sll_m_maxwell_1d_fem_sm.F90.

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

◆ multiply_mass_1d_fem_sm()

subroutine sll_m_maxwell_1d_fem_sm::multiply_mass_1d_fem_sm ( class(sll_t_maxwell_1d_fem_sm), intent(inout)  self,
real(kind=f64), dimension(:), intent(in)  in,
real(kind=f64), dimension(:), intent(out)  out,
integer(kind=i32), intent(in)  degree 
)
private

Multiply by the mass matrix.

Parameters
[in,out]selfMaxwell solver class
[in]inCoefficient for each DoF
[out]outCoefficient for each DoF
[in]degreeSpecify the degree of the basis functions

Definition at line 642 of file sll_m_maxwell_1d_fem_sm.F90.

◆ sll_s_compute_b_from_e_1d_fem_sm()

subroutine sll_m_maxwell_1d_fem_sm::sll_s_compute_b_from_e_1d_fem_sm ( class(sll_t_maxwell_1d_fem_sm 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 Bz from Ey using strong 1D Faraday equation for spline coefficients $B_z^{new}(x_j) = B_z^{old}(x_j) - \frac{\Delta t}{\Delta x} (E_y(x_j) - E_y(x_{j-1}) $.

Parameters
selfMaxwell solver class
[in]delta_tTime step

Definition at line 149 of file sll_m_maxwell_1d_fem_sm.F90.

◆ sll_s_compute_curl_part_1d_fem_sm()

subroutine sll_m_maxwell_1d_fem_sm::sll_s_compute_curl_part_1d_fem_sm ( class(sll_t_maxwell_1d_fem_sm 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 163 of file sll_m_maxwell_1d_fem_sm.F90.

◆ sll_s_compute_e_from_b_1d_fem_sm()

subroutine sll_m_maxwell_1d_fem_sm::sll_s_compute_e_from_b_1d_fem_sm ( class(sll_t_maxwell_1d_fem_sm 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 Ey from Bz using weak Ampere formulation

Parameters
selfMaxwell solver class
[in]delta_tTime step
[in]field_inBz
[in,out]field_outEy

Definition at line 131 of file sll_m_maxwell_1d_fem_sm.F90.

◆ sll_s_compute_e_from_rho_1d_fem_sm()

subroutine sll_m_maxwell_1d_fem_sm::sll_s_compute_e_from_rho_1d_fem_sm ( class(sll_t_maxwell_1d_fem_sm self,
real(kind=f64), dimension(:), intent(in)  field_in,
real(kind=f64), dimension(:), intent(out)  field_out 
)
private

compute e from rho using weak Poisson's equation ( rho = G^T M_1 G \phi, e = G \phi )

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

Definition at line 206 of file sll_m_maxwell_1d_fem_sm.F90.

Here is the call graph for this function:

◆ sll_s_compute_rhs_fem_sm()

subroutine sll_m_maxwell_1d_fem_sm::sll_s_compute_rhs_fem_sm ( class(sll_t_maxwell_1d_fem_sm self,
procedure(sll_i_function_1d_real64 func,
integer(kind=i32), intent(in)  degree,
real(kind=f64), dimension(:), intent(out)  coefs_dofs 
)
private

Compute the FEM right-hand-side for a given function f and periodic splines of given degree Its components are $\int f N_i dx$ where $N_i$ is the B-spline starting at $x_i$.

Parameters
selfMaxwell solver class
funcfunction
[in]degreeSpecify the degree of the basis functions
[out]coefs_dofsFinite Element right-hand-side

Definition at line 294 of file sll_m_maxwell_1d_fem_sm.F90.

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