Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
advection_adjoint.f90
1! Copyright (c) 2021-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!
35 use num_types, only: rp
36 use space, only: space_t
37 use field, only: field_t
38 use coefs, only: coef_t
39 use json_module, only : json_file
40 use field_series, only: field_series_t
41 use time_scheme_controller, only: time_scheme_controller_t
42 implicit none
43 private
44
46 type, abstract :: advection_adjoint_t
47 contains
48 procedure(compute_adv_lin), pass(this), deferred :: compute_linear
49 procedure(compute_adv_lin), pass(this), deferred :: compute_adjoint
50 procedure(compute_scalar_adv_lin), pass(this), deferred :: &
51 compute_adjoint_scalar
52 procedure(advection_adjoint_free), pass(this), deferred :: free
53 end type advection_adjoint_t
54
55 interface
56
69 module subroutine advection_adjoint_factory(object, json, coef, &
70 ulag, vlag, wlag, dtlag, tlag, time_scheme, use_dummy, slag)
71 class(advection_adjoint_t), allocatable, intent(inout) :: object
72 type(json_file), intent(inout) :: json
73 type(coef_t), intent(inout), target :: coef
74 type(field_series_t), intent(in), target :: ulag, vlag, wlag
75 real(kind=rp), intent(in), target :: dtlag(10)
76 real(kind=rp), intent(in), target :: tlag(10)
77 type(time_scheme_controller_t), intent(in), target :: time_scheme
78 logical, optional, intent(in) :: use_dummy
79 type(field_series_t), target, optional, intent(in) :: slag
80 end subroutine advection_adjoint_factory
81 end interface
82
83 ! ========================================================================== !
84 ! Linearized advection operator interface
85
86 abstract interface
87
98 subroutine compute_adv_lin(this, vx, vy, vz, vxb, vyb, vzb, fx, fy, fz, &
99 Xh, coef, n)
100 import :: advection_adjoint_t
101 import :: coef_t
102 import :: space_t
103 import :: field_t
104 import :: rp
105 class(advection_adjoint_t), intent(inout) :: this
106 type(space_t), intent(inout) :: Xh
107 type(coef_t), intent(inout) :: coef
108 type(field_t), intent(inout) :: vx, vy, vz
109 type(field_t), intent(inout) :: vxb, vyb, vzb
110 type(field_t), intent(inout) :: fx, fy, fz
111 integer, intent(in) :: n
112 end subroutine compute_adv_lin
113 end interface
114
115 abstract interface
116
126 subroutine compute_scalar_adv_lin(this, vxb, vyb, vzb, s, fs, Xh, coef, &
127 n, dt)
128 import :: advection_adjoint_t
129 import :: coef_t
130 import :: space_t
131 import :: field_t
132 import :: rp
133 class(advection_adjoint_t), intent(inout) :: this
134 type(field_t), intent(inout) :: vxb, vyb, vzb
135 type(field_t), intent(inout) :: s
136 type(field_t), intent(inout) :: fs
137 type(space_t), intent(inout) :: Xh
138 type(coef_t), intent(inout) :: coef
139 real(kind=rp), intent(in), optional :: dt
140 integer, intent(in) :: n
141 end subroutine compute_scalar_adv_lin
142 end interface
143
144 abstract interface
145
146 subroutine advection_adjoint_free(this)
147 import :: advection_adjoint_t
148 class(advection_adjoint_t), intent(inout) :: this
149 end subroutine advection_adjoint_free
150 end interface
151
152 public :: advection_adjoint_t, advection_adjoint_factory
153end module advection_adjoint
Subroutines to add advection terms to the RHS of a transport equation.
Base abstract type for computing the advection operator.