Neko 1.99.2
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
advection_fctry.f90
Go to the documentation of this file.
1! Copyright (c) 2024, The Neko Authors
2! All rights reserved.
3!
4! Redistribution and use in source and binary forms, with or without
5! modification, are permitted provided that the following conditions
6! are met:
7!
8! * Redistributions of source code must retain the above copyright
9! notice, this list of conditions and the following disclaimer.
10!
11! * Redistributions in binary form must reproduce the above
12! copyright notice, this list of conditions and the following
13! disclaimer in the documentation and/or other materials provided
14! with the distribution.
15!
16! * Neither the name of the authors nor the names of its
17! contributors may be used to endorse or promote products derived
18! from this software without specific prior written permission.
19!
20! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23! FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24! COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26! BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30! ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31! POSSIBILITY OF SUCH DAMAGE.
32!
34submodule(advection) advection_fctry
37
38 ! Advection and derivatives
39 use adv_dealias, only : adv_dealias_t
41 use adv_oifs, only : adv_oifs_t
42 use adv_dummy, only : adv_dummy_t
43
44
45contains
46
60 module subroutine advection_factory(object, json, coef, ulag, vlag, wlag, &
61 dtlag, tlag, time_scheme, use_dummy, slag)
62 class(advection_t), allocatable, intent(inout) :: object
63 type(json_file), intent(inout) :: json
64 type(coef_t), intent(inout), target :: coef
65 type(field_series_t), intent(in), target :: ulag, vlag, wlag
66 real(kind=rp), intent(in), target :: dtlag(10)
67 real(kind=rp), intent(in), target :: tlag(10)
68 type(time_scheme_controller_t), intent(in), target :: time_scheme
69 logical, optional, intent(in) :: use_dummy
70 type(field_series_t), target, optional, intent(in) :: slag
71
72 logical :: dealias, oifs
73 real(kind=rp) :: ctarget
74 integer :: lxd, order
75
76 ! Free allocatables if necessary
77 if (allocated(object)) then
78 call object%free
79 deallocate(object)
80 end if
81
82 if (present(use_dummy)) then
83 if (use_dummy) then
84 allocate(adv_dummy_t::object)
85 return
86 end if
87 end if
88
89 ! Read the parameters from the json file
90 call json_get(json, 'dealias', dealias)
91 call json_get_or_lookup(json, 'polynomial_order', order)
92 call json_get_or_default(json, 'oifs', oifs, .false.)
93
94 call json_get_or_lookup_or_default(json, 'dealiased_polynomial_order', &
95 lxd, ( 3 * (order + 1) ) / 2)
96
97 call json_get_or_lookup_or_default(json, 'oifs_target_cfl', ctarget, 1.9_rp)
98
99
100 if (oifs) then
101 allocate(adv_oifs_t::object)
102 else
103 if (dealias) then
104 allocate(adv_dealias_t::object)
105 else
106 allocate(adv_no_dealias_t::object)
107 end if
108 end if
109
110 select type (adv => object)
111 type is (adv_dealias_t)
112 call adv%init(lxd, coef)
113 type is (adv_no_dealias_t)
114 call adv%init(coef)
115 type is (adv_oifs_t)
116 if (present(slag)) then
117 call adv%init(lxd, coef, ctarget, ulag, vlag, wlag, &
118 dtlag, tlag, time_scheme, slag)
119 else
120 call adv%init(lxd, coef, ctarget, ulag, vlag, wlag, &
121 dtlag, tlag, time_scheme)
122 end if
123 end select
124
125 end subroutine advection_factory
126
127
128end submodule advection_fctry
Retrieves a parameter by name or assigns a provided default value. In the latter case also adds the m...
Retrieves a parameter by name or throws an error.
Subroutines to add advection terms to the RHS of a transport equation.
Implements adv_dummy_t
Definition adv_dummy.f90:34
Subroutines to add advection terms to the RHS of a transport equation.
Subroutines to add advection terms to the RHS of a transport equation.
Definition adv_oifs.f90:34
Subroutines to add advection terms to the RHS of a transport equation.
Definition advection.f90:34
Utilities for retrieving parameters from the case files.
Base class for time integration schemes.
Type encapsulating advection routines with dealiasing.
A zero-valued advection that can be used to kill the advection term.
Definition adv_dummy.f90:44
Type encapsulating advection routines with no dealiasing applied.