Report Typos and Errors    
Semi-Lagrangian Library
Modular library for kinetic and gyrokinetic simulations of plasmas in fusion energy devices.
sll_m_characteristics_2d_base.F90
Go to the documentation of this file.
1 !**************************************************************
2 ! Copyright INRIA
3 ! Authors :
4 ! CALVI project team
5 !
6 ! This code SeLaLib (for Semi-Lagrangian-Library)
7 ! is a parallel library for simulating the plasma turbulence
8 ! in a tokamak.
9 !
10 ! This software is governed by the CeCILL-B license
11 ! under French law and abiding by the rules of distribution
12 ! of free software. You can use, modify and redistribute
13 ! the software under the terms of the CeCILL-B license as
14 ! circulated by CEA, CNRS and INRIA at the following URL
15 ! "http://www.cecill.info".
16 !**************************************************************
17 
21 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22 #include "sll_assert.h"
23 #include "sll_working_precision.h"
24 
25  implicit none
26 
27  public :: &
32 
33  private
34 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
35 
36  ! For computing the characteristics in 2d
38  contains
39  procedure(signature_compute_characteristics_2d), deferred, pass(charac) :: &
40  compute_characteristics
41 ! procedure(sll_i_signature_process_outside_point), deferred, pass :: &
42 ! process_outside_point1
43 ! procedure(sll_i_signature_process_outside_point), deferred, pass :: &
44 ! process_outside_point2
45 
47 
48  abstract interface
49  !solves eta1'(t) = A1(eta1(t),eta2(t)), eta2'(t)=A2(eta1(t),eta2(t))
50  !A1 <=> A1
51  !A2 <=> A2
52  !dt <=> dt
53  !eta1(dt) <=> input1
54  !eta2(dt) <=> input2
55  !eta1(0) <=> output1
56  !eta2(0) <=> output2
58  charac, &
59  A1, &
60  A2, &
61  dt, &
62  input1, &
63  input2, &
64  output1, &
65  output2)
68  class(sll_c_characteristics_2d_base) :: charac
69  sll_real64, dimension(:, :), intent(in) :: a1
70  sll_real64, dimension(:, :), intent(in) :: a2
71  sll_real64, intent(in) :: dt
72  sll_real64, dimension(:), intent(in) :: input1
73  sll_real64, dimension(:), intent(in) :: input2
74  sll_real64, dimension(:, :), intent(out) :: output1
75  sll_real64, dimension(:, :), intent(out) :: output2
76 
78  end interface
79 
80  abstract interface
81  ! change the value of eta when eta<=eta_min or eta>=eta_max
82  ! depending on boundary conditions
83  function sll_i_signature_process_outside_point(eta, eta_min, eta_max) result(eta_out)
85  sll_real64, intent(in) :: eta
86  sll_real64, intent(in) :: eta_min
87  sll_real64, intent(in) :: eta_max
88  sll_real64 :: eta_out
90  end interface
91 
92 contains
93 
94  ! periodic case
95  ! called when bc_type = sll_p_periodic
96  function sll_f_process_outside_point_periodic(eta, eta_min, eta_max) result(eta_out)
98  sll_real64, intent(in) :: eta
99  sll_real64, intent(in) :: eta_min
100  sll_real64, intent(in) :: eta_max
101  sll_real64 :: eta_out
102 
103  eta_out = (eta - eta_min)/(eta_max - eta_min)
104  eta_out = eta_out - real(floor(eta_out), kind=f64)
105  if (eta_out == 1._f64) then
106  eta_out = 0._f64
107  end if
108  if (.not. ((eta_out >= 0) .and. (eta_out < 1))) then
109  print *, '#eta=', eta
110  print *, '#eta_min=', eta_min
111  print *, '#eta_max=', eta_max
112  print *, '#(eta-eta_min)/(eta_max-eta_min)=', (eta - eta_min)/(eta_max - eta_min)
113  print *, '#floor(-1e-19)', floor(-1e-19)
114  print *, '#eta_out=', eta_out
115  end if
116  sll_assert((eta_out >= 0) .and. (eta_out < 1))
117  eta_out = eta_min + eta_out*(eta_max - eta_min)
118  sll_assert((eta_out >= eta_min) .and. (eta_out < eta_max))
119 
121 
122  ! set to limit case
123  ! called when bc_type = SLL_SET_TO_LIMIT
124 
125  function sll_f_process_outside_point_set_to_limit(eta, eta_min, eta_max) result(eta_out)
127  sll_real64, intent(in) :: eta
128  sll_real64, intent(in) :: eta_min
129  sll_real64, intent(in) :: eta_max
130  sll_real64 :: eta_out
131 
132  eta_out = (eta - eta_min)/(eta_max - eta_min)
133  if (eta_out > 1) then
134  eta_out = 1._f64
135  end if
136  if (eta_out < 0) then
137  eta_out = 0._f64
138  end if
139  sll_assert((eta_out >= 0) .and. (eta_out <= 1))
140  eta_out = eta_min + eta_out*(eta_max - eta_min)
141  sll_assert((eta_out >= eta_min) .and. (eta_out <= eta_max))
142 
144 
Abstract class to compute the characteristic in two dimensions.
real(kind=f64) function, public sll_f_process_outside_point_periodic(eta, eta_min, eta_max)
real(kind=f64) function, public sll_f_process_outside_point_set_to_limit(eta, eta_min, eta_max)
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