Report Typos and Errors    
Semi-Lagrangian Library
Modular library for kinetic and gyrokinetic simulations of plasmas in fusion energy devices.
sll_m_qn_solver_2d_fem_sps_weak_form.F90
Go to the documentation of this file.
2 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 
5 
7 
8  implicit none
9 
11 
12  private
13 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
14 
15  ! Working precision
16  integer, parameter :: wp = f64
17 
19 
20  contains
21 
24 
26 
27 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
28 contains
29 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
30 
31  ! Compute elementary contribution to stiffness and mass matrices
33  self, &
34  test_values_and_derivs_eta1, &
35  test_values_and_derivs_eta2, &
36  trial_values_and_derivs_eta1, &
37  trial_values_and_derivs_eta2, &
38  int_volume, &
39  inv_metric, &
40  coeffs1, &
41  coeffs2, &
42  Aij, &
43  Mij)
44  class(sll_t_qn_solver_2d_fem_sps_weak_form), intent(in) :: self
45  real(wp), intent(in) :: test_values_and_derivs_eta1(:, :)
46  real(wp), intent(in) :: test_values_and_derivs_eta2(:, :)
47  real(wp), intent(in) :: trial_values_and_derivs_eta1(:, :)
48  real(wp), intent(in) :: trial_values_and_derivs_eta2(:, :)
49  real(wp), intent(in) :: int_volume(:, :)
50  real(wp), intent(in) :: inv_metric(:, :, :, :)
51  real(wp), intent(in) :: coeffs1(:, :)
52  real(wp), intent(in) :: coeffs2(:, :)
53  real(wp), intent(out) :: Aij
54  real(wp), intent(out) :: Mij
55 
56  integer :: q1, q2, Nq1, Nq2
57 
58  real(wp) :: v(2), w(2), t(2)
59 
60  ! Extract number of quadrature points
61  nq1 = size(test_values_and_derivs_eta1, 1)
62  nq2 = size(test_values_and_derivs_eta2, 1)
63 
64  aij = 0.0_wp
65  mij = 0.0_wp
66 
67  ! Quadrature
68  do q2 = 1, nq2
69  do q1 = 1, nq1
70 
71  ! 2D gradient in logical test space
72  v = [test_values_and_derivs_eta1(q1, 2)*test_values_and_derivs_eta2(q2, 1), &
73  test_values_and_derivs_eta1(q1, 1)*test_values_and_derivs_eta2(q2, 2)]
74 
75  ! 2D gradient in logical trial space
76  w = [trial_values_and_derivs_eta1(q1, 2)*trial_values_and_derivs_eta2(q2, 1), &
77  trial_values_and_derivs_eta1(q1, 1)*trial_values_and_derivs_eta2(q2, 2)]
78 
79  t = matmul(inv_metric(q1, q2, :, :), w)
80 
81  ! Elementary contribution to stiffness matrix
82  aij = aij + (coeffs1(q1, q2)*dot_product(v, t) + coeffs2(q1, q2)* &
83  test_values_and_derivs_eta1(q1, 1)*test_values_and_derivs_eta2(q2, 1)* &
84  trial_values_and_derivs_eta1(q1, 1)*trial_values_and_derivs_eta2(q2, 1))* &
85  int_volume(q1, q2)
86 
87  ! Elementary contribution to mass matrix
88  mij = mij + &
89  test_values_and_derivs_eta1(q1, 1)*test_values_and_derivs_eta2(q2, 1)* &
90  trial_values_and_derivs_eta1(q1, 1)*trial_values_and_derivs_eta2(q2, 1)* &
91  int_volume(q1, q2)
92 
93  end do
94  end do
95 
97 
98  ! Compute elementary contribution to right hand side
100  self, &
101  test_values_and_derivs_eta1, &
102  test_values_and_derivs_eta2, &
103  data_2d_rhs, &
104  int_volume, &
105  bi)
106  class(sll_t_qn_solver_2d_fem_sps_weak_form), intent(in) :: self
107  real(wp), intent(in) :: test_values_and_derivs_eta1(:, :)
108  real(wp), intent(in) :: test_values_and_derivs_eta2(:, :)
109  real(wp), intent(in) :: data_2d_rhs(:, :)
110  real(wp), intent(in) :: int_volume(:, :)
111  real(wp), intent(out) :: bi
112 
113  integer :: q1, q2, Nq1, Nq2
114 
115  ! Extract number of quadrature points
116  nq1 = size(test_values_and_derivs_eta1, 1)
117  nq2 = size(test_values_and_derivs_eta2, 1)
118 
119  bi = 0.0_wp
120 
121  ! Quadrature
122  do q2 = 1, nq2
123  do q1 = 1, nq1
124 
125  ! Elementary contribution to mass matrix
126  bi = bi + &
127  test_values_and_derivs_eta1(q1, 1)*test_values_and_derivs_eta2(q2, 1)* &
128  data_2d_rhs(q1, q2)*int_volume(q1, q2)
129 
130  end do
131  end do
132 
134 
subroutine s_qn_solver_2d_fem_sps_weak_form__element_rhs(self, test_values_and_derivs_eta1, test_values_and_derivs_eta2, data_2d_rhs, int_volume, bi)
subroutine s_qn_solver_2d_fem_sps_weak_form__element_mat(self, test_values_and_derivs_eta1, test_values_and_derivs_eta2, trial_values_and_derivs_eta1, trial_values_and_derivs_eta2, int_volume, inv_metric, coeffs1, coeffs2, Aij, Mij)
Module to select the kind parameter.
integer, parameter, public f64
f64 is the kind type for 64-bit reals (double precision)
    Report Typos and Errors