Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
advection_adjoint_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!
35 use num_types, only: rp
36 use coefs, only: coef_t
37 use json_utils, only: json_get
38 use json_module, only: json_file
39
40 ! Advection and derivatives
44
45 implicit none
46 private
47
49
50contains
51
57 subroutine advection_adjoint_factory(object, json, coef)
58 implicit none
59 class(advection_adjoint_t), allocatable, intent(inout) :: object
60 type(json_file), intent(inout) :: json
61 type(coef_t), target :: coef
62 logical :: dealias, found
63 integer :: lxd, order
64
65 call json_get(json, 'case.numerics.dealias', dealias)
66 call json%get('case.numerics.dealiased_polynomial_order', lxd, found)
67 if (.not. found) then
68 call json_get(json, 'case.numerics.polynomial_order', order)
69 ! Note, assumes odd polynomial order
70 lxd = 3 * (order + 1) / 2
71 end if
72
73 ! Free allocatables if necessary
74 if (allocated(object)) then
75 call object%free
76 deallocate(object)
77 end if
78
79 if (dealias) then
80 allocate(adv_lin_dealias_t::object)
81 else
82 allocate(adv_lin_no_dealias_t::object)
83 end if
84
85 select type (adv => object)
86 type is (adv_lin_dealias_t)
87 if (lxd .gt. 0) then
88 call adv%init(lxd, coef)
89 else
90 call adv%init(coef%Xh%lx * 3 / 2, coef)
91 end if
92 type is (adv_lin_no_dealias_t)
93 call adv%init(coef)
94 end select
95
96 end subroutine advection_adjoint_factory
97
98
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.
Contains the factory routine for advection_t children.
subroutine, public advection_adjoint_factory(object, json, coef)
A factory for advection_t decendants.
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.
Base abstract type for computing the advection operator.