Neko 1.99.5
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
fluid_pnpn_bc_fctry.f90
Go to the documentation of this file.
1
2! Copyright (c) 2024, 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!
36submodule(fluid_pnpn) fluid_pnpn_bc_fctry
37 use user_intf, only : user_t
38 use utils, only : neko_type_error
40 use inflow, only : inflow_t
41 use blasius, only : blasius_t
42 use dirichlet, only : dirichlet_t
44 use symmetry, only : symmetry_t
45 use non_normal, only : non_normal_t
46 use no_slip, only : no_slip_t
53 implicit none
54
55 ! List of all possible types created by the boundary condition factories
56 character(len=25) :: FLUID_PNPN_KNOWN_BCS(15) = [character(len=25) :: &
57 "symmetry", &
58 "velocity_value", &
59 "no_slip", &
60 "outflow", &
61 "normal_outflow", &
62 "outflow+user", &
63 "normal_outflow+user", &
64 "outflow+dong", &
65 "normal_outflow+dong", &
66 "shear_stress", &
67 "user_velocity", &
68 "user_pressure", &
69 "blasius_profile", &
70 "wall_model", &
71 "overset_interface"]
72
73contains
74
81 module subroutine pressure_bc_factory(object, scheme, json, coef, user)
82 class(bc_t), pointer, intent(inout) :: object
83 type(fluid_pnpn_t), intent(in) :: scheme
84 type(json_file), intent(inout) :: json
85 type(coef_t), target, intent(in) :: coef
86 type(user_t), intent(in) :: user
87 character(len=:), allocatable :: type
88 integer :: i, j, k
89 integer, allocatable :: zone_indices(:)
90 character(len=:), allocatable :: default_name
91 character(len=64) :: buf
92 logical :: temp_logical
93
94 if (associated(object)) then
95 call object%free()
96 nullify(object)
97 end if
98
99 call json_get(json, "type", type)
100
101 select case (trim(type))
102 case ("outflow", "normal_outflow")
103 allocate(zero_dirichlet_t::object)
104
105 case ("outflow+dong", "normal_outflow+dong")
106 allocate(dong_outflow_t::object)
107
108 case ("user_pressure", "outflow+user", "normal_outflow+user")
109 allocate(field_dirichlet_t::object)
110 select type (obj => object)
111 type is (field_dirichlet_t)
112 obj%update => user%dirichlet_conditions
113 call json%add("field_name", scheme%p%name)
114 end select
115
116 case ("overset_interface")
117 call json_get_or_default(json, "couple_pressure", temp_logical, .false.)
118 if (temp_logical) then
119 allocate(overset_interface_t::object)
120 select type (obj => object)
121 type is (overset_interface_t)
122 call json%add("field_name", scheme%p%name)
123 obj%morph_interface => user%morph_interface
124 end select
125 else
126 return
127 end if
128
129 case default
130 do i = 1, size(fluid_pnpn_known_bcs)
131 if (trim(type) .eq. trim(fluid_pnpn_known_bcs(i))) return
132 end do
133 call neko_type_error("fluid_pnpn boundary conditions", type, &
134 FLUID_PNPN_KNOWN_BCS)
135 end select
136
137 call json_get_or_lookup(json, "zone_indices", zone_indices)
138 call object%init(coef, json)
139
140 do i = 1, size(zone_indices)
141 call object%mark_zone(coef%msh%labeled_zones(zone_indices(i)))
142 end do
143
144 write(buf, '("pressure_bc_", I0)') zone_indices(1)
145 default_name = trim(buf)
146 call json_get_or_default(json, "name", object%name, default_name)
147 object%zone_indices = zone_indices
148 call object%finalize()
149
150 ! All pressure bcs are currently strong, so for all of them we
151 ! mark with value 1 in the mesh
152 do i = 1, size(zone_indices)
153 do j = 1, scheme%msh%nelv
154 do k = 1, 2 * scheme%msh%gdim
155 if (scheme%msh%facet_type(k,j) .eq. -zone_indices(i)) then
156 scheme%msh%facet_type(k, j) = 1
157 end if
158 end do
159 end do
160 end do
161
162 if (allocated(type)) then
163 deallocate(type)
164 end if
165
166 if (allocated(zone_indices)) then
167 deallocate(zone_indices)
168 end if
169 end subroutine pressure_bc_factory
170
177 module subroutine velocity_bc_factory(object, scheme, json, coef, user)
178 class(bc_t), pointer, intent(inout) :: object
179 type(fluid_pnpn_t), intent(inout) :: scheme
180 type(json_file), intent(inout) :: json
181 type(coef_t), target, intent(in) :: coef
182 type(user_t), intent(in) :: user
183 character(len=:), allocatable :: type
184 integer :: i, j, k
185 integer, allocatable :: zone_indices(:)
186 character(len=:), allocatable :: default_name
187 character(len=64) :: buf
188
189 call json_get(json, "type", type)
190
191 select case (trim(type))
192 case ("symmetry")
193 allocate(symmetry_t::object)
194 case ("velocity_value")
195 allocate(inflow_t::object)
196 case ("no_slip")
197 allocate(no_slip_t::object)
198 case ("normal_outflow", "normal_outflow+dong", "normal_outflow+user")
199 allocate(non_normal_t::object)
200 case ("blasius_profile")
201 allocate(blasius_t::object)
202 case ("shear_stress")
203 allocate(shear_stress_t::object)
204 case ("wall_model")
205 allocate(wall_model_bc_t::object)
206 ! Kind of hack, but OK for now
207 call json%add("scheme_name", scheme%name)
208
209 case ("user_velocity")
210 allocate(field_dirichlet_vector_t::object)
211 select type (obj => object)
213 obj%update => user%dirichlet_conditions
214 end select
215
216 case ("overset_interface")
217 allocate(overset_interface_vector_t::object)
218 select type (obj => object)
220 obj%morph_interface => user%morph_interface
221 end select
222
223 case default
224 do i = 1, size(fluid_pnpn_known_bcs)
225 if (trim(type) .eq. trim(fluid_pnpn_known_bcs(i))) return
226 end do
227 call neko_type_error("fluid_pnpn boundary conditions", type, &
228 FLUID_PNPN_KNOWN_BCS)
229 end select
230
231 call json_get_or_lookup(json, "zone_indices", zone_indices)
232 call object%init(coef, json)
233 do i = 1, size(zone_indices)
234 call object%mark_zone(coef%msh%labeled_zones(zone_indices(i)))
235 end do
236
237 write(buf,'("velocity_bc_",I0)') zone_indices(1)
238 default_name = trim(buf)
239 call json_get_or_default(json, "name", object%name, default_name)
240 object%zone_indices = zone_indices
241 call object%finalize()
242
243 ! Exclude these two because they are bcs for the residual, not velocity
244 if (trim(type) .ne. "normal_outflow" .and. &
245 trim(type) .ne. "normal_outflow+dong") then
246 do i = 1, size(zone_indices)
247 do j = 1, scheme%msh%nelv
248 do k = 1, 2 * scheme%msh%gdim
249 if (scheme%msh%facet_type(k,j) .eq. -zone_indices(i)) then
250 scheme%msh%facet_type(k, j) = 2
251 end if
252 end do
253 end do
254 end do
255 end if
256
257 if (allocated(type)) then
258 deallocate(type)
259 end if
260
261 if (allocated(zone_indices)) then
262 deallocate(zone_indices)
263 end if
264 end subroutine velocity_bc_factory
265
266end submodule fluid_pnpn_bc_fctry
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.
Modular version of the Classic Nek5000 Pn/Pn formulation for fluids.
Defines inflow dirichlet conditions.
Definition inflow.f90:34
Defines no-slip boundary condition (extends zero_dirichlet)
Definition no_slip.f90:34
Dirichlet condition on axis aligned plane in the non normal direction.
Defines overset interface vector boundary conditions.
Defines overset interface scalar boundary conditions.
Defines a shear stress boundary condition for a vector field. Maintainer: Timofey Mukha.
Mixed Dirichlet-Neumann axis aligned symmetry plane.
Definition symmetry.f90:34
Interfaces for user interaction with NEKO.
Definition user_intf.f90:34
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:365
Defines the wall_model_bc_t type. Maintainer: Timofey Mukha.
Defines a zero-valued Dirichlet boundary condition.
Blasius profile for inlet (vector valued).
Definition blasius.f90:55
Generic Dirichlet boundary condition on .
Definition dirichlet.f90:49
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:47
Dirichlet condition in non normal direction of a plane.
Overset interface BC for a scalar field.
Extension of the user defined dirichlet condition overset_interface
A shear stress boundary condition.
Mixed Dirichlet-Neumann symmetry plane condition.
Definition symmetry.f90:50
A type collecting all the overridable user routines and flag to suppress type injection from custom m...
A shear stress boundary condition, computing the stress values using a wall model.
Zero-valued Dirichlet boundary condition. Used for no-slip walls, but also for various auxillary cond...