Loading [MathJax]/jax/output/HTML-CSS/config.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
fluid_scheme_base.f90
Go to the documentation of this file.
1! Copyright (c) 2025, 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!
34 use bc, only : bc_t
35 use checkpoint, only : chkp_t
36 use coefs, only: coef_t
37 use dirichlet, only : dirichlet_t
38 use dofmap, only : dofmap_t
39 use field, only : field_t
41 use gather_scatter, only : gs_t
42 use json_module, only : json_file
43 use logger, only : log_size
44 use num_types, only : rp
46 use space, only : space_t, gll
50 use user_intf, only : user_t
51 use usr_inflow, only : usr_inflow_eval
52 use utils, only : neko_error
53 use bc_list, only : bc_list_t
54 implicit none
55 private
56 public :: fluid_scheme_base_t, fluid_scheme_base_factory
57
59 type, abstract :: fluid_scheme_base_t
60 type(space_t) :: xh
61 type(dofmap_t) :: dm_xh
62 type(gs_t) :: gs_xh
63 type(coef_t) :: c_xh
64
65 type(time_scheme_controller_t), allocatable :: ext_bdf
66
68 type(field_t), pointer :: u => null()
69 type(field_t), pointer :: v => null()
70 type(field_t), pointer :: w => null()
71 type(field_t), pointer :: p => null()
72 type(field_series_t) :: ulag, vlag, wlag
73
75 real(kind=rp) :: rho
76 type(field_t) :: rho_field
77
79 type(field_t), pointer :: f_x => null()
81 type(field_t), pointer :: f_y => null()
83 type(field_t), pointer :: f_z => null()
84
86 ! List of boundary conditions for pressure
87 type(bc_list_t) :: bcs_prs
88 ! List of boundary conditions for velocity
89 type(bc_list_t) :: bcs_vel
90
91 type(json_file), pointer :: params
92 type(mesh_t), pointer :: msh => null()
93 type(chkp_t) :: chkp
94
96 character(len=NEKO_MSH_MAX_ZLBL_LEN), allocatable :: bc_labels(:)
97
99 real(kind=rp) :: mu
100
102 type(field_t) :: mu_field
103
105 logical :: variable_material_properties = .false.
107 logical :: freeze = .false.
108
109 contains
111 procedure(fluid_scheme_base_init_intrf), pass(this), deferred :: init
113 procedure(fluid_scheme_base_free_intrf), pass(this), deferred :: free
115 procedure(fluid_scheme_base_step_intrf), pass(this), deferred :: step
117 procedure(fluid_scheme_base_restart_intrf), pass(this), deferred :: restart
118 ! Setup boundary conditions
119 procedure(fluid_scheme_setup_bcs_intrf), pass(this), deferred :: setup_bcs
120
122 procedure(validate_intrf), pass(this), deferred :: validate
124 procedure(fluid_scheme_base_compute_cfl_intrf), pass(this), deferred :: compute_cfl
127 end type fluid_scheme_base_t
128
130 abstract interface
131 subroutine fluid_base_init_all_intrf(this, msh, lx, params, kspv_init, &
132 kspp_init, scheme, user)
134 import mesh_t
135 import json_file
136 import user_t
137 import rp
138 import log_size
139 class(fluid_scheme_base_t), target, intent(inout) :: this
140 type(mesh_t), target, intent(inout) :: msh
141 integer, intent(inout) :: lx
142 type(json_file), target, intent(inout) :: params
143 type(user_t), target, intent(in) :: user
144 logical :: kspv_init
145 logical :: kspp_init
146 character(len=*), intent(in) :: scheme
147 real(kind=rp) :: abs_tol
148 integer :: integer_val, ierr
149 logical :: logical_val
150 character(len=:), allocatable :: solver_type, precon_type
151 character(len=LOG_SIZE) :: log_buf
152 real(kind=rp) :: gjp_param_a, gjp_param_b
153 end subroutine fluid_base_init_all_intrf
154 end interface
155
157 abstract interface
158 subroutine fluid_base_init_common_intrf(this, msh, lx, params, scheme, &
159 user, kspv_init)
161 import mesh_t
162 import json_file
163 import user_t
164 import dirichlet_t
165 import log_size
166 import rp
167 class(fluid_scheme_base_t), target, intent(inout) :: this
168 type(mesh_t), target, intent(inout) :: msh
169 integer, intent(inout) :: lx
170 character(len=*), intent(in) :: scheme
171 type(json_file), target, intent(inout) :: params
172 type(user_t), target, intent(in) :: user
173 logical, intent(in) :: kspv_init
174 type(dirichlet_t) :: bdry_mask
175 character(len=LOG_SIZE) :: log_buf
176 real(kind=rp), allocatable :: real_vec(:)
177 real(kind=rp) :: real_val, kappa, b, z0
178 logical :: logical_val
179 integer :: integer_val, ierr
180 type(json_file) :: wm_json
181 character(len=:), allocatable :: string_val1, string_val2
182 end subroutine fluid_base_init_common_intrf
183 end interface
184
186 abstract interface
187 subroutine fluid_base_free_intrf(this)
189 class(fluid_scheme_base_t), intent(inout) :: this
190 end subroutine fluid_base_free_intrf
191 end interface
192
194 abstract interface
195 subroutine fluid_scheme_base_init_intrf(this, msh, lx, params, user)
197 import json_file
198 import mesh_t
199 import user_t
201 class(fluid_scheme_base_t), target, intent(inout) :: this
202 type(mesh_t), target, intent(inout) :: msh
203 integer, intent(in) :: lx
204 type(json_file), target, intent(inout) :: params
205 type(user_t), target, intent(in) :: user
206 end subroutine fluid_scheme_base_init_intrf
207 end interface
208
210 abstract interface
213 class(fluid_scheme_base_t), intent(inout) :: this
214 end subroutine fluid_scheme_base_free_intrf
215 end interface
216
218 abstract interface
219 subroutine fluid_scheme_base_step_intrf(this, t, tstep, dt, ext_bdf, &
220 dt_controller)
224 import rp
225 class(fluid_scheme_base_t), target, intent(inout) :: this
226 real(kind=rp), intent(in) :: t
227 integer, intent(in) :: tstep
228 real(kind=rp), intent(in) :: dt
229 type(time_scheme_controller_t), intent(in) :: ext_bdf
230 type(time_step_controller_t), intent(in) :: dt_controller
231 end subroutine fluid_scheme_base_step_intrf
232 end interface
233
235 abstract interface
236 subroutine fluid_scheme_base_restart_intrf(this, dtlag, tlag)
238 import rp
239 class(fluid_scheme_base_t), target, intent(inout) :: this
240 real(kind=rp) :: dtlag(10), tlag(10)
241
243 end interface
244
246 abstract interface
247 subroutine fluid_scheme_setup_bcs_intrf(this, user, params)
248 import fluid_scheme_base_t, user_t, json_file
249 class(fluid_scheme_base_t), intent(inout) :: this
250 type(user_t), target, intent(in) :: user
251 type(json_file), intent(inout) :: params
252 end subroutine fluid_scheme_setup_bcs_intrf
253 end interface
254
256 abstract interface
257 subroutine validate_intrf(this)
259 class(fluid_scheme_base_t), target, intent(inout) :: this
260 end subroutine validate_intrf
261 end interface
262
264 abstract interface
267 import json_file
268 import user_t
269 class(fluid_scheme_base_t), intent(inout) :: this
270 end subroutine update_material_properties
271 end interface
272
274 abstract interface
275 function fluid_scheme_base_compute_cfl_intrf(this, dt) result(c)
277 import rp
278 class(fluid_scheme_base_t), intent(in) :: this
279 real(kind=rp), intent(in) :: dt
280 real(kind=rp) :: c
282 end interface
283
284 interface
285
286 module subroutine fluid_scheme_base_factory(object, type_name)
287 class(fluid_scheme_base_t), intent(inout), allocatable :: object
288 character(len=*) :: type_name
289 end subroutine fluid_scheme_base_factory
290 end interface
291end module fluid_scheme_base
Initialize common data for the current scheme.
Abstract interface to dealocate a fluid formulation.
Abstract interface to initialize a fluid formulation.
Abstract interface to restart a fluid scheme.
Abstract interface to compute a time-step.
Abstract interface to setup boundary conditions.
Abstract interface to sets rho and mu.
Abstract interface to validate the user inflow.
Abstract interface defining a user defined inflow condition (pointwise)
Defines a list of bc_t.
Definition bc_list.f90:34
Defines a boundary condition.
Definition bc.f90:34
Defines a checkpoint.
Coefficients.
Definition coef.f90:34
Defines a dirichlet boundary condition.
Definition dirichlet.f90:34
Defines a mapping of the degrees of freedom.
Definition dofmap.f90:35
Stores a series fields.
Defines a field.
Definition field.f90:34
Gather-scatter.
Logging routines.
Definition log.f90:34
integer, parameter, public log_size
Definition log.f90:42
Defines a mesh.
Definition mesh.f90:34
integer, parameter, public neko_msh_max_zlbl_len
Max length of a zone label.
Definition mesh.f90:58
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Defines a function space.
Definition space.f90:34
integer, parameter, public gll
Definition space.f90:48
Compound scheme for the advection and diffusion operators in a transport equation.
Implements type time_step_controller.
Interfaces for user interaction with NEKO.
Definition user_intf.f90:34
Defines inflow dirichlet conditions.
Utilities.
Definition utils.f90:35
Base type for a boundary condition.
Definition bc.f90:57
A list of allocatable `bc_t`. Follows the standard interface of lists.
Definition bc_list.f90:47
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Definition coef.f90:55
Generic Dirichlet boundary condition on .
Definition dirichlet.f90:47
Base type of all fluid formulations.
The function space for the SEM solution fields.
Definition space.f90:62
Implements the logic to compute the time coefficients for the advection and diffusion operators in a ...