Neko 1.99.2
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
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 coefs, only : coef_t
35 use dirichlet, only : dirichlet_t
36 use dofmap, only : dofmap_t
37 use field, only : field_t
39 use gather_scatter, only : gs_t
40 use json_module, only : json_file
41 use logger, only : log_size
42 use num_types, only : rp
43 use checkpoint, only : chkp_t
45 use space, only : space_t
49 use utils, only : neko_error
50 use bc_list, only : bc_list_t
51 use field_list, only : field_list_t
52 use time_state, only : time_state_t
53 implicit none
54 private
55 public :: fluid_scheme_base_t, fluid_scheme_base_factory
56
58 type, abstract :: fluid_scheme_base_t
60 character(len=:), allocatable :: name
61
62 type(space_t) :: xh
63 type(dofmap_t) :: dm_xh
64 type(gs_t) :: gs_xh
65 type(coef_t) :: c_xh
66
67 type(time_scheme_controller_t), allocatable :: ext_bdf
68
70 type(field_t), pointer :: u => null()
71 type(field_t), pointer :: v => null()
72 type(field_t), pointer :: w => null()
73 type(field_t), pointer :: p => null()
74 type(field_series_t) :: ulag, vlag, wlag
75
77 type(chkp_t), pointer :: chkp => null()
78
80 type(field_t), pointer :: f_x => null()
82 type(field_t), pointer :: f_y => null()
84 type(field_t), pointer :: f_z => null()
85
87 ! List of boundary conditions for pressure
88 type(bc_list_t) :: bcs_prs
89 ! List of boundary conditions for velocity
90 type(bc_list_t) :: bcs_vel
91
92 type(json_file), pointer :: params
93 type(mesh_t), pointer :: msh => null()
94
96 character(len=NEKO_MSH_MAX_ZLBL_LEN), allocatable :: bc_labels(:)
97
99 type(field_t), pointer :: rho => null()
100
102 type(field_t), pointer :: mu => null()
103
105 type(field_list_t) :: material_properties
106
108 logical :: freeze = .false.
109
111 procedure(user_material_properties_intf), nopass, pointer :: &
112 user_material_properties => null()
113
114 contains
116 procedure(fluid_scheme_base_init_intrf), pass(this), deferred :: init
118 procedure(fluid_scheme_base_free_intrf), pass(this), deferred :: free
120 procedure(fluid_scheme_base_step_intrf), pass(this), deferred :: step
122 procedure(fluid_scheme_base_restart_intrf), pass(this), deferred :: restart
123 ! Setup boundary conditions
124 procedure(fluid_scheme_setup_bcs_intrf), pass(this), deferred :: setup_bcs
125
127 procedure(validate_intrf), pass(this), deferred :: validate
129 procedure(fluid_scheme_base_compute_cfl_intrf), pass(this), deferred :: &
130 compute_cfl
132 procedure(update_material_properties), pass(this), deferred :: &
134 end type fluid_scheme_base_t
135
137 abstract interface
138 subroutine fluid_base_init_all_intrf(this, msh, lx, params, kspv_init, &
139 kspp_init, scheme, user)
141 import mesh_t
142 import json_file
143 import user_t
144 import rp
145 import log_size
146 class(fluid_scheme_base_t), target, intent(inout) :: this
147 type(mesh_t), target, intent(inout) :: msh
148 integer, intent(inout) :: lx
149 type(json_file), target, intent(inout) :: params
150 type(user_t), target, intent(in) :: user
151 logical :: kspv_init
152 logical :: kspp_init
153 character(len=*), intent(in) :: scheme
154 real(kind=rp) :: abs_tol
155 integer :: integer_val, ierr
156 logical :: logical_val
157 character(len=:), allocatable :: solver_type, precon_type
158 character(len=LOG_SIZE) :: log_buf
159 real(kind=rp) :: gjp_param_a, gjp_param_b
160 end subroutine fluid_base_init_all_intrf
161 end interface
162
164 abstract interface
165 subroutine fluid_base_init_common_intrf(this, msh, lx, params, scheme, &
166 user, kspv_init)
168 import mesh_t
169 import json_file
170 import user_t
171 import dirichlet_t
172 import log_size
173 import rp
174 class(fluid_scheme_base_t), target, intent(inout) :: this
175 type(mesh_t), target, intent(inout) :: msh
176 integer, intent(inout) :: lx
177 character(len=*), intent(in) :: scheme
178 type(json_file), target, intent(inout) :: params
179 type(user_t), target, intent(in) :: user
180 logical, intent(in) :: kspv_init
181 type(dirichlet_t) :: bdry_mask
182 character(len=LOG_SIZE) :: log_buf
183 real(kind=rp), allocatable :: real_vec(:)
184 real(kind=rp) :: real_val, kappa, b, z0
185 logical :: logical_val
186 integer :: integer_val, ierr
187 type(json_file) :: wm_json
188 character(len=:), allocatable :: string_val1, string_val2
189 end subroutine fluid_base_init_common_intrf
190 end interface
191
193 abstract interface
194 subroutine fluid_base_free_intrf(this)
196 class(fluid_scheme_base_t), intent(inout) :: this
197 end subroutine fluid_base_free_intrf
198 end interface
199
201 abstract interface
202 subroutine fluid_scheme_base_init_intrf(this, msh, lx, params, user, chkp)
204 import json_file
205 import mesh_t
206 import user_t
207 import chkp_t
209 class(fluid_scheme_base_t), target, intent(inout) :: this
210 type(mesh_t), target, intent(inout) :: msh
211 integer, intent(in) :: lx
212 type(json_file), target, intent(inout) :: params
213 type(user_t), target, intent(in) :: user
214 type(chkp_t), target, intent(inout) :: chkp
215 end subroutine fluid_scheme_base_init_intrf
216 end interface
217
219 abstract interface
222 class(fluid_scheme_base_t), intent(inout) :: this
223 end subroutine fluid_scheme_base_free_intrf
224 end interface
225
227 abstract interface
228 subroutine fluid_scheme_base_step_intrf(this, time, dt_controller)
229 import time_state_t
232 class(fluid_scheme_base_t), target, intent(inout) :: this
233 type(time_state_t), intent(in) :: time
234 type(time_step_controller_t), intent(in) :: dt_controller
235 end subroutine fluid_scheme_base_step_intrf
236 end interface
237
239 abstract interface
240 subroutine fluid_scheme_base_restart_intrf(this, chkp)
242 import chkp_t
243 class(fluid_scheme_base_t), target, intent(inout) :: this
244 type(chkp_t), intent(inout) :: chkp
246 end interface
247
249 abstract interface
250 subroutine fluid_scheme_setup_bcs_intrf(this, user, params)
251 import fluid_scheme_base_t, user_t, json_file
252 class(fluid_scheme_base_t), target, intent(inout) :: this
253 type(user_t), target, intent(in) :: user
254 type(json_file), intent(inout) :: params
255 end subroutine fluid_scheme_setup_bcs_intrf
256 end interface
257
259 abstract interface
260 subroutine validate_intrf(this)
262 class(fluid_scheme_base_t), target, intent(inout) :: this
263 end subroutine validate_intrf
264 end interface
265
267 abstract interface
268 subroutine update_material_properties(this, time)
270 class(fluid_scheme_base_t), intent(inout) :: this
271 type(time_state_t), intent(in) :: time
272 end subroutine update_material_properties
273 end interface
274
276 abstract interface
277 function fluid_scheme_base_compute_cfl_intrf(this, dt) result(c)
279 import rp
280 class(fluid_scheme_base_t), intent(in) :: this
281 real(kind=rp), intent(in) :: dt
282 real(kind=rp) :: c
284 end interface
285
286 interface
287
288 module subroutine fluid_scheme_base_factory(object, type_name)
289 class(fluid_scheme_base_t), intent(inout), allocatable :: object
290 character(len=*) :: type_name
291 end subroutine fluid_scheme_base_factory
292 end interface
293end 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 for setting material properties.
Defines a list of bc_t.
Definition bc_list.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
Contains the field_serties_t type.
Defines a field.
Definition field.f90:34
Gather-scatter.
Logging routines.
Definition log.f90:34
integer, parameter, public log_size
Definition log.f90:46
Defines a mesh.
Definition mesh.f90:34
integer, parameter, public neko_msh_max_zlbl_len
Max length of a zone label.
Definition mesh.f90:65
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Defines a function space.
Definition space.f90:34
Compound scheme for the advection and diffusion operators in a transport equation.
Module with things related to the simulation time.
Implements type time_step_controller.
Interfaces for user interaction with NEKO.
Definition user_intf.f90:34
Utilities.
Definition utils.f90:35
A list of allocatable `bc_t`. Follows the standard interface of lists.
Definition bc_list.f90:48
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Definition coef.f90:56
Generic Dirichlet boundary condition on .
Definition dirichlet.f90:49
field_list_t, To be able to group fields together
Stores a series (sequence) of fields, logically connected to a base field, and arranged according to ...
Base type of all fluid formulations.
The function space for the SEM solution fields.
Definition space.f90:63
Implements the logic to compute the time coefficients for the advection and diffusion operators in a ...
A struct that contains all info about the time, expand as needed.
A type collecting all the overridable user routines and flag to suppress type injection from custom m...