Loading [MathJax]/extensions/tex2jax.js
Neko 0.9.99
A portable framework for high-order spectral element flow simulations
All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros Pages
euler_bc_fctry.f90
Go to the documentation of this file.
1
2! Copyright (c) 2025, The Neko Authors
3! All rights reserved.
4!
5! Redistribution and use in source and binary forms, with or without
6! modification, are permitted provided that the following conditions
7! are met:
8!
9! * Redistributions of source code must retain the above copyright
10! notice, this list of conditions and the following disclaimer.
11!
12! * Redistributions in binary form must reproduce the above
13! copyright notice, this list of conditions and the following
14! disclaimer in the documentation and/or other materials provided
15! with the distribution.
16!
17! * Neither the name of the authors nor the names of its
18! contributors may be used to endorse or promote products derived
19! from this software without specific prior written permission.
20!
21! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24! FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25! COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27! BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31! ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32! POSSIBILITY OF SUCH DAMAGE.
33!
34!
35submodule(fluid_scheme_compressible_euler) euler_bc_fctry
36 use user_intf, only : user_t
37 use utils, only : neko_type_error
39 use dirichlet, only : dirichlet_t
40 use inflow, only : inflow_t
42 use blasius, only : blasius_t
43 use dirichlet, only : dirichlet_t
45 use symmetry, only : symmetry_t
46 use non_normal, only : non_normal_t
48 implicit none
49
50 ! List of all possible types created by the boundary condition factories
51 character(len=25) :: EULER_KNOWN_BCS(7) = [character(len=25) :: &
52 "velocity_value", &
53 "density_value", &
54 "pressure_value", &
55 "no_slip", &
56 "symmetry", &
57 "outflow", &
58 "normal_outflow"]
59
60contains
67 module subroutine density_bc_factory(object, scheme, json, coef, user)
68 class(bc_t), pointer, intent(inout) :: object
69 type(fluid_scheme_compressible_euler_t), intent(in) :: scheme
70 type(json_file), intent(inout) :: json
71 type(coef_t), intent(in) :: coef
72 type(user_t), intent(in) :: user
73 character(len=:), allocatable :: type
74 integer :: i, j, k
75 integer, allocatable :: zone_indices(:)
76
77 call json_get(json, "type", type)
78
79 select case (trim(type))
80 case ("density_value")
81 allocate(dirichlet_t::object)
82 case default
83 do i = 1, size(euler_known_bcs)
84 if (trim(type) .eq. trim(euler_known_bcs(i))) return
85 end do
86 call neko_type_error("compressible_euler boundary conditions", type, &
87 EULER_KNOWN_BCS)
88 end select
89
90 call json_get(json, "zone_indices", zone_indices)
91 call object%init(coef, json)
92
93 do i = 1, size(zone_indices)
94 call object%mark_zone(coef%msh%labeled_zones(zone_indices(i)))
95 end do
96 call object%finalize()
97 end subroutine density_bc_factory
98
105 module subroutine pressure_bc_factory(object, scheme, json, coef, user)
106 class(bc_t), pointer, intent(inout) :: object
107 type(fluid_scheme_compressible_euler_t), intent(in) :: scheme
108 type(json_file), intent(inout) :: json
109 type(coef_t), intent(in) :: coef
110 type(user_t), intent(in) :: user
111 character(len=:), allocatable :: type
112 integer :: i, j, k
113 integer, allocatable :: zone_indices(:)
114
115 call json_get(json, "type", type)
116
117 select case (trim(type))
118 case ("outflow", "normal_outflow")
119 allocate(zero_dirichlet_t::object)
120 case ("pressure_value")
121 allocate(dirichlet_t::object)
122 case default
123 do i = 1, size(euler_known_bcs)
124 if (trim(type) .eq. trim(euler_known_bcs(i))) return
125 end do
126 call neko_type_error("compressible_euler boundary conditions", type, &
127 EULER_KNOWN_BCS)
128 end select
129
130 call json_get(json, "zone_indices", zone_indices)
131 call object%init(coef, json)
132
133 do i = 1, size(zone_indices)
134 call object%mark_zone(coef%msh%labeled_zones(zone_indices(i)))
135 end do
136 call object%finalize()
137
138 ! All pressure bcs are currently strong, so for all of them we
139 ! mark with value 1 in the mesh
140 do i = 1, size(zone_indices)
141 do j = 1, scheme%msh%nelv
142 do k = 1, 2 * scheme%msh%gdim
143 if (scheme%msh%facet_type(k,j) .eq. -zone_indices(i)) then
144 scheme%msh%facet_type(k, j) = 1
145 end if
146 end do
147 end do
148 end do
149 end subroutine pressure_bc_factory
150
157 module subroutine velocity_bc_factory(object, scheme, json, coef, user)
158 class(bc_t), pointer, intent(inout) :: object
159 type(fluid_scheme_compressible_euler_t), intent(in) :: scheme
160 type(json_file), intent(inout) :: json
161 type(coef_t), intent(in) :: coef
162 type(user_t), intent(in) :: user
163 character(len=:), allocatable :: type
164 integer :: i, j, k
165 integer, allocatable :: zone_indices(:)
166
167 call json_get(json, "type", type)
168
169 select case (trim(type))
170 case ("symmetry")
171 allocate(symmetry_t::object)
172 case ("no_slip")
173 allocate(zero_dirichlet_t::object)
174 case ("velocity_value")
175 allocate(inflow_t::object)
176 case default
177 do i = 1, size(euler_known_bcs)
178 if (trim(type) .eq. trim(euler_known_bcs(i))) return
179 end do
180 call neko_type_error("compressible_euler boundary conditions", type, &
181 EULER_KNOWN_BCS)
182 end select
183
184 call json_get(json, "zone_indices", zone_indices)
185 call object%init(coef, json)
186 do i = 1, size(zone_indices)
187 call object%mark_zone(coef%msh%labeled_zones(zone_indices(i)))
188 end do
189 call object%finalize()
190
191 end subroutine velocity_bc_factory
192
193end submodule euler_bc_fctry
Abstract interface defining a user defined inflow condition (pointwise)
Defines a Blasius profile dirichlet condition.
Definition blasius.f90:34
Defines a dirichlet boundary condition.
Definition dirichlet.f90:34
Defines a dong outflow condition.
Defines inflow dirichlet conditions.
Defines user dirichlet condition for a scalar field.
Defines inflow dirichlet conditions.
Definition inflow.f90:34
Dirichlet condition on axis aligned plane in the non normal direction.
Mixed Dirichlet-Neumann axis aligned symmetry plane.
Definition symmetry.f90:34
Interfaces for user interaction with NEKO.
Definition user_intf.f90:34
Defines inflow dirichlet conditions.
Utilities.
Definition utils.f90:35
subroutine, public neko_type_error(base_type, wrong_type, known_types)
Reports an error allocating a type for a particular base pointer class.
Definition utils.f90:250
Blasius profile for inlet (vector valued).
Definition blasius.f90:52
Generic Dirichlet boundary condition on .
Definition dirichlet.f90:47
Dong outflow condition Follows "A Convective-like Energy-Stable Open Boundary Condition for Simulati...
User defined dirichlet condition, for which the user can work with an entire field....
Extension of the user defined dirichlet condition field_dirichlet
Dirichlet condition for inlet (vector valued)
Definition inflow.f90:46
Dirichlet condition in non normal direction of a plane.
Mixed Dirichlet-Neumann symmetry plane condition.
Definition symmetry.f90:49
A type collecting all the overridable user routines.
User defined dirichlet condition for velocity.