Neko  0.9.0
A portable framework for high-order spectral element flow simulations
ext_time_scheme.f90
Go to the documentation of this file.
1 ! Copyright (c) 2008-2020, UCHICAGO ARGONNE, LLC.
2 !
3 ! The UChicago Argonne, LLC as Operator of Argonne National
4 ! Laboratory holds copyright in the Software. The copyright holder
5 ! reserves all rights except those expressly granted to licensees,
6 ! and U.S. Government license rights.
7 !
8 ! Redistribution and use in source and binary forms, with or without
9 ! modification, are permitted provided that the following conditions
10 ! are met:
11 !
12 ! 1. Redistributions of source code must retain the above copyright
13 ! notice, this list of conditions and the disclaimer below.
14 !
15 ! 2. Redistributions in binary form must reproduce the above copyright
16 ! notice, this list of conditions and the disclaimer (as noted below)
17 ! in the documentation and/or other materials provided with the
18 ! distribution.
19 !
20 ! 3. Neither the name of ANL nor the names of its contributors
21 ! may be used to endorse or promote products derived from this software
22 ! without specific prior written permission.
23 !
24 ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 ! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 ! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27 ! FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
28 ! UCHICAGO ARGONNE, LLC, THE U.S. DEPARTMENT OF
29 ! ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 ! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
31 ! TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 ! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 ! THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 ! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 ! OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 !
37 ! Additional BSD Notice
38 ! ---------------------
39 ! 1. This notice is required to be provided under our contract with
40 ! the U.S. Department of Energy (DOE). This work was produced at
41 ! Argonne National Laboratory under Contract
42 ! No. DE-AC02-06CH11357 with the DOE.
43 !
44 ! 2. Neither the United States Government nor UCHICAGO ARGONNE,
45 ! LLC nor any of their employees, makes any warranty,
46 ! express or implied, or assumes any liability or responsibility for the
47 ! accuracy, completeness, or usefulness of any information, apparatus,
48 ! product, or process disclosed, or represents that its use would not
49 ! infringe privately-owned rights.
50 !
51 ! 3. Also, reference herein to any specific commercial products, process,
52 ! or services by trade name, trademark, manufacturer or otherwise does
53 ! not necessarily constitute or imply its endorsement, recommendation,
54 ! or favoring by the United States Government or UCHICAGO ARGONNE LLC.
55 ! The views and opinions of authors expressed
56 ! herein do not necessarily state or reflect those of the United States
57 ! Government or UCHICAGO ARGONNE, LLC, and shall
58 ! not be used for advertising or product endorsement purposes.
59 !
62  use neko_config
63  use num_types, only : rp
64  use time_scheme, only: time_scheme_t
65  use math, only : rzero
66  use utils, only : neko_error
67  implicit none
68  private
69 
84  type, public, extends(time_scheme_t) :: ext_time_scheme_t
85  contains
89  procedure, nopass :: compute_modified_coeffs => &
91  end type ext_time_scheme_t
92 
93 contains
94 
98  subroutine ext_time_scheme_compute_coeffs(coeffs, dt, order)
99  implicit none
100  real(kind=rp), intent(out) :: coeffs(4)
101  real(kind=rp), intent(in) :: dt(10)
102  integer, intent(in) :: order
103 
104  call rzero(coeffs, 4)
105 
106  select case (order)
107  case (1)
108  coeffs(1) = 1.0_rp
109  case (2)
110  coeffs(2) = -dt(1) / dt(2)
111  coeffs(1) = 1.0_rp - coeffs(2)
112  case (3)
113  coeffs(3) = dt(1) / (dt(2) + dt(3)) * (dt(1) + dt(2)) / dt(3)
114  coeffs(2) = - dt(1) / dt(2) * (1.0_rp + dt(2) / dt(3) + dt(1) / dt(3))
115  coeffs(1) = 1.0_rp - coeffs(2) - coeffs(3)
116  case default
117  call neko_error("The order of the EXT time scheme must be 1 to 3.")
118  end select
119  end subroutine ext_time_scheme_compute_coeffs
120 
124  implicit none
125  real(kind=rp), intent(out) :: coeffs(4)
126  real(kind=rp), intent(in) :: dt(10)
127  real(kind=rp) dta, dtb, dtc, dtd, dte, dts
128 
129  call rzero(coeffs, 4)
130 
131  dts = dt(2) + dt(3)
132  dta = dt(1) / dt(2)
133  dtb = dt(2) / dt(3)
134  dtc = dt(1) / dt(3)
135  dtd = dts / dt(2)
136  dte = dt(1) / dts
137  coeffs(3) = 2.0_rp / 3.0_rp * dtc * (1.0_rp / dtd + dte)
138  coeffs(2) = -dta - coeffs(3) * dtd
139  coeffs(1) = 1.0_rp - coeffs(2) - coeffs(3)
140 
142 end module ext_time_scheme
Interface for setting the scheme coefficients.
Definition: time_scheme.f90:79
Explicit extrapolation scheme for time integration.
subroutine ext_time_scheme_compute_modified_coeffs(coeffs, dt)
Compute the modified scheme coefficients.
subroutine ext_time_scheme_compute_coeffs(coeffs, dt, order)
Compute the scheme coefficients.
Definition: math.f90:60
subroutine, public rzero(a, n)
Zero a real vector.
Definition: math.f90:195
Build configurations.
Definition: neko_config.f90:34
integer, parameter, public rp
Global precision used in computations.
Definition: num_types.f90:12
Base class for time integration schemes.
Definition: time_scheme.f90:61
Utilities.
Definition: utils.f90:35
Explicit extrapolation scheme for time integration.
Base abstract class for time integration schemes.
Definition: time_scheme.f90:69