Report Typos and Errors    
Semi-Lagrangian Library
Modular library for kinetic and gyrokinetic simulations of plasmas in fusion energy devices.
sll_m_linear_operator_ecsim_ev.F90
Go to the documentation of this file.
2 #include "sll_working_precision.h"
4 
5  use sll_m_spline_fem_utilities, only : &
7 
8  implicit none
9 
11 
12  private
13 
15 
16  sll_int32 :: degree
17  sll_real64 :: dt
18  sll_real64 :: dx
19  sll_real64, allocatable :: mass_line_0(:)
20  sll_real64, allocatable :: mass_line_1(:)
21  sll_real64, pointer :: m1(:,:), m2(:,:), m4(:,:)
22 
23 
24  contains
25  procedure :: create => create_linear_operator_ecsim_ev
26  procedure :: free => free_ecsim_ev
27  procedure :: dot => dot_mono_r2r_ecsim_ev
28  procedure :: print_info => print_info_ecsim_ev
29 
31 
32 contains
33 
34  subroutine create_linear_operator_ecsim_ev( self, n_dof, degree, &
35  mass_line_0,mass_line_1, m1, m2, m4)
36  class(sll_t_linear_operator_ecsim_ev), intent( inout ) :: self
37  sll_int32 :: n_dof
38  sll_int32 :: degree
39  sll_real64 :: mass_line_0(:)
40  sll_real64 :: mass_line_1(:)
41  sll_real64,target :: m1(:,:)
42  sll_real64,target :: m2(:,:)
43  sll_real64,target :: m4(:,:)
44 
45 
46  self%n_dof=n_dof
47  self%degree=degree
48  self%dt=0.0_f64
49  self%m1=>m1
50  self%m2=>m2
51  self%m4=>m4
52  allocate(self%mass_line_0(degree+1))
53  allocate(self%mass_line_1(degree))
54  self%mass_line_0=mass_line_0
55  self%mass_line_1=mass_line_1
56 
57 
58  self%n_rows = 2*n_dof
59  self%n_cols = 2*n_dof
60 
61  self%n_global_rows = self%n_rows
62  self%n_global_cols = self%n_cols
63  end subroutine create_linear_operator_ecsim_ev
64 
65 
66  subroutine free_ecsim_ev( self )
67  class(sll_t_linear_operator_ecsim_ev), intent( inout ) :: self
68  deallocate(self%mass_line_0)
69  deallocate(self%mass_line_1)
70  self%m1=>null()
71  self%m2=>null()
72  self%m4=>null()
73 
74  end subroutine free_ecsim_ev
75 
76  subroutine dot_mono_r2r_ecsim_ev( self, x, y )
77  class(sll_t_linear_operator_ecsim_ev), intent( in ) :: self
78  sll_real64, intent( in ) :: x(:)
79  sll_real64, intent( out ) :: y(:)
80  ! local variables
81  sll_int32 :: row, column
82 
83  y=0.0_f64
84  do row=1, self%n_dof
85  ! Multiplication of the inputvector with entries of the mass and particle-mass matrices
86  y(row) = (self%mass_line_1(1)+0.5_f64*self%dt*self%m1(1,row))*x(row)
87  y(self%n_dof+row)= (self%mass_line_0(1)+0.5_f64*self%dt*self%m4(1,row))*x(self%n_dof+row)
88 
89  do column = 2, self%degree
90  y(row) = y(row) +&
91  self%mass_line_1(column) * &
92  (x(modulo(row+column-2,self%n_dof)+1) +&
93  x(modulo(row-column,self%n_dof)+1))+&
94  0.5_f64*self%dt*self%m1(column,row) * &
95  x(modulo(row+column-2,self%n_dof)+1)+&
96  0.5_f64*self%dt*self%m1(column,modulo(row-column,self%n_dof)+1) * &
97  x(modulo(row-column,self%n_dof)+1)
98 
99  end do
100  do column = 2, self%degree+1
101  y(self%n_dof+row) = y(self%n_dof+row) +&
102  self%mass_line_0(column) * &
103  (x(self%n_dof+modulo(row+column-2,self%n_dof)+1) +&
104  x(self%n_dof+ modulo(row-column,self%n_dof)+1))+&
105  0.5_f64*self%dt*self%m4(column,row)*&
106  x(self%n_dof+modulo(row+column-2,self%n_dof)+1)+&
107  0.5_f64*self%dt*self%m4(column,modulo(row-column,self%n_dof)+1)*&
108  x(self%n_dof+modulo(row-column,self%n_dof)+1)
109  end do
110 
111  do column = 1, 2*self%degree
112  y(row) = y(row) - &
113  0.5_f64*self%dt*self%m2(7-column,modulo(column-4+row-1,self%n_dof)+1)*&
114  x(self%n_dof+modulo(row+column-self%degree-2,self%n_dof)+1)
115 
116  y(row+self%n_dof) = y(row+self%n_dof) + &
117  0.5_f64*self%dt*self%m2(column,row) * &
118  x(modulo(row+column-self%degree-1,self%n_dof)+1)
119  end do
120  end do
121 
122  end subroutine dot_mono_r2r_ecsim_ev
123 
124  subroutine print_info_ecsim_ev( self )
125  class(sll_t_linear_operator_ecsim_ev), intent(in) :: self
126  end subroutine print_info_ecsim_ev
127 
module for abstract linear operator
subroutine create_linear_operator_ecsim_ev(self, n_dof, degree, mass_line_0, mass_line_1, m1, m2, m4)
Utilites for Maxwell solver's with spline finite elements.
subroutine, public sll_s_spline_fem_mass_line(degree, mass_line)
Computes the mass line for a mass matrix with degree splines.
    Report Typos and Errors