Report Typos and Errors    
Semi-Lagrangian Library
Modular library for kinetic and gyrokinetic simulations of plasmas in fusion energy devices.
sll_m_linear_operator_particle_mass_cl_3d_od.F90
Go to the documentation of this file.
2 #include "sll_working_precision.h"
3 
4  use sll_m_particle_mass_3d_base, only: &
6 
7 
8  implicit none
9 
11 
12  private
13 
15 
16  sll_int32 :: degree2(3)
17  sll_int32 :: n_dofs2(3)
18  sll_int32 :: n_total2
19 
20 
21  contains
23  procedure :: free => free_particle_mass_cl_3d_od
24  procedure :: dot => dot_particle_mass_cl_3d_od
25  procedure :: print_info => print_info_particle_mass_cl_3d_od
26 
28 
29 
30 contains
31 
32  subroutine create_linear_operator_particle_mass_cl_3d_od( self, n_cells, degree, degree2 )
33  class(sll_t_linear_operator_particle_mass_cl_3d_od), intent( inout ) :: self
34  sll_int32, intent( in ) :: n_cells(3)
35  sll_int32, intent( in ) :: degree(3)
36  sll_int32, optional, intent( in ) :: degree2(3)
37 
38  self%degree = degree
39  self%n_dofs = n_cells
40  self%n_dofs(1) = n_cells(1)+degree(1)
41  self%n_total = product(self%n_dofs)
42  self%degree2 = degree2
43  self%n_dofs2 = n_cells
44  self%n_dofs2(1) = n_cells(1)+degree2(1)
45  self%n_total2 = product(self%n_dofs2)
46 
47  allocate( self%particle_mass( product(self%degree+self%degree2+1), self%n_total))
48  self%particle_mass = 0._f64
49 
50  self%n_rows = self%n_total
51  self%n_cols = self%n_total2
52 
53  self%n_global_rows = self%n_rows
54  self%n_global_cols = self%n_cols
55 
57 
58  subroutine free_particle_mass_cl_3d_od( self )
59  class(sll_t_linear_operator_particle_mass_cl_3d_od), intent( inout ) :: self
60 
61  deallocate( self%particle_mass )
62 
63  end subroutine free_particle_mass_cl_3d_od
64 
65 
66  subroutine dot_particle_mass_cl_3d_od ( self, x, y )
67  class(sll_t_linear_operator_particle_mass_cl_3d_od), intent( in ) :: self
68  sll_real64, intent( in ) :: x(:)
69  sll_real64, intent( out ) :: y(:)
70  !local variables
71  sll_int32 :: ind_i, ind_j, ind
72  sll_int32 :: i1, i2, i3, j1, j2, j3
73 
74  ind_i = 1
75  do i3 = 1, self%n_dofs(3)
76  do i2 = 1, self%n_dofs(2)
77  do i1 = 1, self%degree(1)
78  y(ind_i) = 0.0_f64
79  ind = 1
80  do j3 = i3-self%degree2(3), i3+self%degree(3)
81  do j2 = i2-self%degree2(2), i2+self%degree(2)
82  ind = ind + self%degree(1)+1-i1
83  do j1 = 1, i1+self%degree2(1)
84  ind_j = j1 + modulo(j2-1,self%n_dofs2(2))*self%n_dofs2(1) + modulo(j3-1,self%n_dofs2(3))*self%n_dofs2(1)*self%n_dofs2(2)
85  y(ind_i) = y(ind_i) + &
86  self%sign * self%particle_mass( ind, ind_i) * x(ind_j)
87  ind = ind+1
88  end do
89  end do
90  end do
91  ind_i = ind_i + 1
92  end do
93  do i1 = self%degree(1)+1, self%n_dofs(1)-self%degree(1)
94  y(ind_i) = 0.0_f64
95  ind = 1
96  do j3 = i3-self%degree2(3), i3+self%degree(3)
97  do j2 = i2-self%degree2(2), i2+self%degree(2)
98  do j1 = i1-self%degree(1), i1+self%degree2(1)
99  ind_j = j1 + modulo(j2-1,self%n_dofs2(2))*self%n_dofs2(1) + modulo(j3-1,self%n_dofs2(3))*self%n_dofs2(1)*self%n_dofs2(2)
100  y(ind_i) = y(ind_i) + &
101  self%sign * self%particle_mass( ind, ind_i) * x(ind_j)
102  ind = ind+1
103  end do
104  end do
105  end do
106  ind_i = ind_i + 1
107  end do
108  do i1 = self%n_dofs(1)-self%degree(1)+1, self%n_dofs(1)
109  y(ind_i) = 0.0_f64
110  ind = 1
111  do j3 = i3-self%degree2(3), i3+self%degree(3)
112  do j2 = i2-self%degree2(2), i2+self%degree(2)
113  do j1 = i1-self%degree(1), self%n_dofs2(1)
114  ind_j = j1 + modulo(j2-1,self%n_dofs2(2))*self%n_dofs2(1) + modulo(j3-1,self%n_dofs2(3))*self%n_dofs2(1)*self%n_dofs2(2)
115  y(ind_i) = y(ind_i) + &
116  self%sign * self%particle_mass( ind, ind_i) * x(ind_j)
117  ind = ind+1
118  end do
119  ind = ind + self%degree(1)-self%n_dofs(1)+i1
120  end do
121  end do
122  ind_i = ind_i + 1
123  end do
124  end do
125  end do
126 
127 
128  end subroutine dot_particle_mass_cl_3d_od
129 
130 
132  class(sll_t_linear_operator_particle_mass_cl_3d_od), intent(in) :: self
133  end subroutine print_info_particle_mass_cl_3d_od
134 
subroutine create_linear_operator_particle_mass_cl_3d_od(self, n_cells, degree, degree2)
    Report Typos and Errors