Report Typos and Errors    
Semi-Lagrangian Library
Modular library for kinetic and gyrokinetic simulations of plasmas in fusion energy devices.
sll_m_characteristics_1d_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 1d
38  contains
39  procedure(signature_compute_characteristics_1d), deferred, pass(charac) :: &
40  compute_characteristics
41 
43 
44  abstract interface
45  !solves eta'(t) = A(eta1(t))
46  !A <=> A
47  !dt <=> dt
48  !eta(dt) <=> input
49  !eta(0) <=> output
50 
52  charac, &
53  A, &
54  dt, &
55  input, &
56  output)
59  class(sll_c_characteristics_1d_base) :: charac
60  sll_real64, dimension(:), intent(in) :: a
61  sll_real64, intent(in) :: dt
62  sll_real64, dimension(:), intent(in) :: input
63  sll_real64, dimension(:), intent(out) :: output
64 
66  end interface
67 
68  abstract interface
69  ! change the value of eta when eta<=eta_min or eta>=eta_max
70  ! depending on boundary conditions
71  function sll_i_signature_process_outside_point_1d(eta, eta_min, eta_max) result(eta_out)
73  sll_real64, intent(in) :: eta
74  sll_real64, intent(in) :: eta_min
75  sll_real64, intent(in) :: eta_max
76  sll_real64 :: eta_out
78  end interface
79 
80 contains
81 
82  ! periodic case
83  ! called when bc_type = sll_p_periodic
84  function sll_f_process_outside_point_periodic(eta, eta_min, eta_max) result(eta_out)
86  sll_real64, intent(in) :: eta
87  sll_real64, intent(in) :: eta_min
88  sll_real64, intent(in) :: eta_max
89  sll_real64 :: eta_out
90 
91  eta_out = (eta - eta_min)/(eta_max - eta_min)
92  eta_out = eta_out - real(floor(eta_out), kind=f64)
93  if (eta_out == 1._f64) then
94  eta_out = 0._f64
95  end if
96  if (.not. ((eta_out >= 0) .and. (eta_out < 1))) then
97  print *, '#eta=', eta
98  print *, '#eta_min=', eta_min
99  print *, '#eta_max=', eta_max
100  print *, '#(eta-eta_min)/(eta_max-eta_min)=', (eta - eta_min)/(eta_max - eta_min)
101  print *, '#floor(-1e-19)', floor(-1e-19)
102  print *, '#eta_out=', eta_out
103  end if
104  sll_assert((eta_out >= 0) .and. (eta_out < 1))
105  eta_out = eta_min + eta_out*(eta_max - eta_min)
106  sll_assert((eta_out >= eta_min) .and. (eta_out < eta_max))
107 
109 
110  ! set to limit case
111  ! called when bc_type = SLL_SET_TO_LIMIT
112 
113  function sll_f_process_outside_point_set_to_limit(eta, eta_min, eta_max) result(eta_out)
115  sll_real64, intent(in) :: eta
116  sll_real64, intent(in) :: eta_min
117  sll_real64, intent(in) :: eta_max
118  sll_real64 :: eta_out
119 
120  eta_out = (eta - eta_min)/(eta_max - eta_min)
121  if (eta_out > 1) then
122  eta_out = 1._f64
123  end if
124  if (eta_out < 0) then
125  eta_out = 0._f64
126  end if
127  sll_assert((eta_out >= 0) .and. (eta_out <= 1))
128  eta_out = eta_min + eta_out*(eta_max - eta_min)
129  sll_assert((eta_out >= eta_min) .and. (eta_out <= eta_max))
130 
132 
Abstract class for characteristic derived type.
function, public sll_f_process_outside_point_set_to_limit(eta, eta_min, eta_max)
function, public sll_f_process_outside_point_periodic(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