Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
advection_adjoint_fctry.f90
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_adjoint) advection_adjoint_fctry
35 use json_utils, only: json_get, json_get_or_default
36 use utils, only: neko_error
37
38 ! Advection and derivatives
41
42contains
43
57 module subroutine advection_adjoint_factory(object, json, coef, ulag, vlag, wlag, &
58 dtlag, tlag, time_scheme, use_dummy, slag)
59 class(advection_adjoint_t), allocatable, intent(inout) :: object
60 type(json_file), intent(inout) :: json
61 type(coef_t), intent(inout), target :: coef
62 type(field_series_t), intent(in), target :: ulag, vlag, wlag
63 real(kind=rp), intent(in), target :: dtlag(10)
64 real(kind=rp), intent(in), target :: tlag(10)
65 type(time_scheme_controller_t), intent(in), target :: time_scheme
66 logical, optional, intent(in) :: use_dummy
67 type(field_series_t), target, optional, intent(in) :: slag
68
69 logical :: dealias, oifs
70 real(kind=rp) :: ctarget
71 integer :: lxd, order
72
73 ! Free allocatables if necessary
74 if (allocated(object)) then
75 call object%free
76 deallocate(object)
77 end if
78
79 if (present(use_dummy)) then
80 if (use_dummy .eqv. .true.) then
81 call neko_error("Dummy advection is not supported in the adjoint module.")
82 return
83 end if
84 end if
85
86 call json_get(json, 'dealias', dealias)
87 call json_get(json, 'polynomial_order', order)
88 call json_get_or_default(json, 'oifs', oifs, .false.)
89
90 call json_get_or_default(json, 'dealiased_polynomial_order', &
91 lxd, (3 * (order + 1)) / 2)
92
93 call json_get_or_default(json, 'target_cfl', ctarget, 1.9_rp)
94
95 if (oifs) then
96 call neko_error("OIFS advection is not supported in the adjoint module.")
97 else
98 if (dealias) then
99 allocate(adv_lin_dealias_t::object)
100 else
101 allocate(adv_lin_no_dealias_t::object)
102 end if
103 end if
104
105 select type (adv => object)
106 type is (adv_lin_dealias_t)
107 call adv%init(lxd, coef)
108 type is (adv_lin_no_dealias_t)
109 call adv%init(coef)
110 ! type is (adv_oifs_t)
111 ! if (present(slag)) then
112 ! call adv%init(lxd, coef, ctarget, ulag, vlag, wlag, &
113 ! dtlag, tlag, time_scheme, slag)
114 ! else
115 ! call adv%init(lxd, coef, ctarget, ulag, vlag, wlag, &
116 ! dtlag, tlag, time_scheme)
117 ! end if
118 end select
119
120 end subroutine advection_adjoint_factory
121
122
123end submodule advection_adjoint_fctry
Subroutines to add advection terms to the RHS of a transport equation.
Subroutines to add perturbed advection terms to the RHS of a transport equation.
Subroutines to add advection terms to the RHS of a transport equation.
Type encapsulating advection routines with dealiasing.
Type encapsulating advection routines with no dealiasing applied.