Neko 1.99.1
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 :: compute_cfl
132 end type fluid_scheme_base_t
133
135 abstract interface
136 subroutine fluid_base_init_all_intrf(this, msh, lx, params, kspv_init, &
137 kspp_init, scheme, user)
139 import mesh_t
140 import json_file
141 import user_t
142 import rp
143 import log_size
144 class(fluid_scheme_base_t), target, intent(inout) :: this
145 type(mesh_t), target, intent(inout) :: msh
146 integer, intent(inout) :: lx
147 type(json_file), target, intent(inout) :: params
148 type(user_t), target, intent(in) :: user
149 logical :: kspv_init
150 logical :: kspp_init
151 character(len=*), intent(in) :: scheme
152 real(kind=rp) :: abs_tol
153 integer :: integer_val, ierr
154 logical :: logical_val
155 character(len=:), allocatable :: solver_type, precon_type
156 character(len=LOG_SIZE) :: log_buf
157 real(kind=rp) :: gjp_param_a, gjp_param_b
158 end subroutine fluid_base_init_all_intrf
159 end interface
160
162 abstract interface
163 subroutine fluid_base_init_common_intrf(this, msh, lx, params, scheme, &
164 user, kspv_init)
166 import mesh_t
167 import json_file
168 import user_t
169 import dirichlet_t
170 import log_size
171 import rp
172 class(fluid_scheme_base_t), target, intent(inout) :: this
173 type(mesh_t), target, intent(inout) :: msh
174 integer, intent(inout) :: lx
175 character(len=*), intent(in) :: scheme
176 type(json_file), target, intent(inout) :: params
177 type(user_t), target, intent(in) :: user
178 logical, intent(in) :: kspv_init
179 type(dirichlet_t) :: bdry_mask
180 character(len=LOG_SIZE) :: log_buf
181 real(kind=rp), allocatable :: real_vec(:)
182 real(kind=rp) :: real_val, kappa, b, z0
183 logical :: logical_val
184 integer :: integer_val, ierr
185 type(json_file) :: wm_json
186 character(len=:), allocatable :: string_val1, string_val2
187 end subroutine fluid_base_init_common_intrf
188 end interface
189
191 abstract interface
192 subroutine fluid_base_free_intrf(this)
194 class(fluid_scheme_base_t), intent(inout) :: this
195 end subroutine fluid_base_free_intrf
196 end interface
197
199 abstract interface
200 subroutine fluid_scheme_base_init_intrf(this, msh, lx, params, user, chkp)
202 import json_file
203 import mesh_t
204 import user_t
205 import chkp_t
207 class(fluid_scheme_base_t), target, intent(inout) :: this
208 type(mesh_t), target, intent(inout) :: msh
209 integer, intent(in) :: lx
210 type(json_file), target, intent(inout) :: params
211 type(user_t), target, intent(in) :: user
212 type(chkp_t), target, intent(inout) :: chkp
213 end subroutine fluid_scheme_base_init_intrf
214 end interface
215
217 abstract interface
220 class(fluid_scheme_base_t), intent(inout) :: this
221 end subroutine fluid_scheme_base_free_intrf
222 end interface
223
225 abstract interface
226 subroutine fluid_scheme_base_step_intrf(this, time, dt_controller)
227 import time_state_t
230 class(fluid_scheme_base_t), target, intent(inout) :: this
231 type(time_state_t), intent(in) :: time
232 type(time_step_controller_t), intent(in) :: dt_controller
233 end subroutine fluid_scheme_base_step_intrf
234 end interface
235
237 abstract interface
238 subroutine fluid_scheme_base_restart_intrf(this, chkp)
240 import chkp_t
241 class(fluid_scheme_base_t), target, intent(inout) :: this
242 type(chkp_t), intent(inout) :: chkp
244 end interface
245
247 abstract interface
248 subroutine fluid_scheme_setup_bcs_intrf(this, user, params)
249 import fluid_scheme_base_t, user_t, json_file
250 class(fluid_scheme_base_t), target, intent(inout) :: this
251 type(user_t), target, intent(in) :: user
252 type(json_file), intent(inout) :: params
253 end subroutine fluid_scheme_setup_bcs_intrf
254 end interface
255
257 abstract interface
258 subroutine validate_intrf(this)
260 class(fluid_scheme_base_t), target, intent(inout) :: this
261 end subroutine validate_intrf
262 end interface
263
265 abstract interface
266 subroutine update_material_properties(this, time)
268 class(fluid_scheme_base_t), intent(inout) :: this
269 type(time_state_t), intent(in) :: time
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 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:64
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:55
Generic Dirichlet boundary condition on .
Definition dirichlet.f90:48
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:62
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...