40 use json_module,
only : json_file
68 type(
field_t),
pointer :: max_wave_speed => null()
70 type(
field_t),
pointer :: effective_visc => null()
72 real(kind=
rp) :: gamma
75 integer(kind=i8) :: glb_n_points
77 integer(kind=i8) :: glb_unique_points
88 procedure, pass(this) :: compute_cfl &
94 procedure, pass(this) :: compute_entropy => &
97 procedure, pass(this) :: compute_max_wave_speed => &
100 procedure, pass(this) :: log_solver_info => &
115 type(
mesh_t),
target,
intent(inout) :: msh
116 integer,
intent(in) :: lx
117 character(len=*),
intent(in) :: scheme
118 type(json_file),
target,
intent(inout) :: params
119 type(
user_t),
target,
intent(in) :: user
127 if (msh%gdim .eq. 2)
then
128 call this%Xh%init(
gll, lx, lx)
130 call this%Xh%init(
gll, lx, lx, lx)
133 call this%dm_Xh%init(msh, this%Xh)
135 call this%gs_Xh%init(this%dm_Xh)
137 call this%c_Xh%init(this%gs_Xh)
143 this%params => params
150 call neko_registry%add_field(this%dm_Xh, this%name //
"_rho")
162 call this%m_x%init(this%dm_Xh,
"m_x")
163 call this%m_y%init(this%dm_Xh,
"m_y")
164 call this%m_z%init(this%dm_Xh,
"m_z")
169 call this%E%init(this%dm_Xh,
"E")
173 this%max_wave_speed =>
neko_registry%get_field(
"max_wave_speed")
174 call this%max_wave_speed%init(this%dm_Xh,
"max_wave_speed")
179 call this%S%init(this%dm_Xh,
"S")
183 this%effective_visc =>
neko_registry%get_field(
"effective_visc")
184 call this%effective_visc%init(this%dm_Xh,
"effective_visc")
193 call this%u%init(this%dm_Xh,
"u")
194 call this%v%init(this%dm_Xh,
"v")
195 call this%w%init(this%dm_Xh,
"w")
198 call this%p%init(this%dm_Xh,
"p")
206 call this%f_x%init(this%dm_Xh, fld_name =
"fluid_rhs_x")
207 call this%f_y%init(this%dm_Xh, fld_name =
"fluid_rhs_y")
208 call this%f_z%init(this%dm_Xh, fld_name =
"fluid_rhs_z")
214 this%glb_n_points = int(this%msh%glb_nelv,
i8)*int(this%Xh%lxyz,
i8)
215 this%glb_unique_points = int(
glsum(this%c_Xh%mult, this%dm_Xh%size()),
i8)
220 call this%log_solver_info(params, scheme, lx)
227 call this%dm_Xh%free()
228 call this%gs_Xh%free()
229 call this%c_Xh%free()
232 if (
associated(this%m_x))
then
236 if (
associated(this%m_y))
then
240 if (
associated(this%m_z))
then
244 if (
associated(this%E))
then
248 if (
associated(this%max_wave_speed))
then
249 call this%max_wave_speed%free()
252 if (
associated(this%S))
then
256 if (
associated(this%f_x))
then
261 if (
associated(this%f_y))
then
266 if (
associated(this%f_z))
then
279 nullify(this%max_wave_speed)
297 integer :: temp_indices(1)
299 n = this%dm_Xh%size()
309 call field_cmult2(this%E, this%p, 1.0_rp/(this%gamma - 1.0_rp), n)
320 call this%compute_max_wave_speed()
330 real(kind=
rp),
intent(in) :: dt
334 associate(u => this%u, v => this%v, w => this%w, p => this%p, &
335 rho => this%rho, xh => this%Xh, c_xh => this%c_Xh, &
336 msh => this%msh, gamma => this%gamma, &
337 max_wave_speed => this%max_wave_speed)
339 n = xh%lx * xh%ly * xh%lz * msh%nelv
351 type(time_state_t),
intent(in) :: time
360 n = this%S%dof%size()
363 if (neko_bcknd_device .eq. 1)
then
364 call compressible_ops_device_compute_entropy(this%S, this%p, this%rho, this%gamma, n)
366 call compressible_ops_cpu_compute_entropy(this%S%x, this%p%x, this%rho%x, this%gamma, n)
377 n = this%u%dof%size()
380 if (neko_bcknd_device .eq. 1)
then
381 call compressible_ops_device_compute_max_wave_speed(this%max_wave_speed, &
382 this%u, this%v, this%w, this%gamma, this%p, this%rho, n)
384 call compressible_ops_cpu_compute_max_wave_speed(this%max_wave_speed%x, &
385 this%u%x, this%v%x, this%w%x, this%gamma, this%p%x, this%rho%x, n)
397 type(json_file),
intent(inout) :: params
398 character(len=*),
intent(in) :: scheme
399 integer,
intent(in) :: lx
400 character(len=LOG_SIZE) :: log_buf
401 logical :: logical_val
402 real(kind=rp) :: real_val
403 integer :: integer_val
405 call neko_log%section(
'Fluid')
406 write(log_buf,
'(A, A)')
'Type : ', trim(scheme)
407 call neko_log%message(log_buf)
408 write(log_buf,
'(A, A)')
'Name : ', trim(this%name)
409 call neko_log%message(log_buf)
413 write(log_buf,
'(A, I1)')
'Poly order : ', lx-1
414 else if (lx .ge. 10)
then
415 write(log_buf,
'(A, I2)')
'Poly order : ', lx-1
417 write(log_buf,
'(A, I3)')
'Poly order : ', lx-1
419 call neko_log%message(log_buf)
422 write(log_buf,
'(A, I0)')
'GLL points : ', this%glb_n_points
423 call neko_log%message(log_buf)
424 write(log_buf,
'(A, I0)')
'Unique pts.: ', this%glb_unique_points
425 call neko_log%message(log_buf)
428 write(log_buf,
'(A,ES13.6)')
'gamma :', this%gamma
429 call neko_log%message(log_buf)
432 call json_get_or_default(params,
'case.numerics.c_avisc_low', real_val, 0.5_rp)
433 write(log_buf,
'(A,ES13.6)')
'c_avisc_low:', real_val
434 call neko_log%message(log_buf)
436 call json_get_or_default(params,
'case.numerics.time_order', integer_val, 4)
437 write(log_buf,
'(A, I0)')
'RK order : ', integer_val
438 call neko_log%message(log_buf)
439 call neko_log%end_section()
Abstract interface to sets rho and mu.
Retrieves a parameter by name or assigns a provided default value. In the latter case also adds the m...
CPU implementation of compressible flow operations.
subroutine, public compressible_ops_cpu_compute_entropy(s, p, rho, gamma, n)
Compute entropy field S = 1/(gamma-1) * rho * (log(p) - gamma * log(rho)) on CPU.
subroutine, public compressible_ops_cpu_compute_max_wave_speed(max_wave_speed, u, v, w, gamma, p, rho, n)
Compute maximum wave speed for compressible flows on CPU.
Device implementation of compressible flow operations.
subroutine, public compressible_ops_device_compute_entropy(s, p, rho, gamma, n)
Compute entropy field S = 1/(gamma-1) * rho * (log(p) - gamma * log(rho)) on device.
subroutine, public compressible_ops_device_compute_max_wave_speed(max_wave_speed, u, v, w, gamma, p, rho, n)
Compute maximum wave speed for compressible flows on device.
subroutine, public field_col2(a, b, n)
Vector multiplication .
subroutine, public field_cmult2(a, b, c, n)
Multiplication by constant c .
subroutine, public field_cfill(a, c, n)
Set all elements to a constant c .
subroutine, public field_addcol3(a, b, c, n)
Returns .
subroutine, public field_add2(a, b, n)
Vector addition .
subroutine, public field_col3(a, b, c, n)
Vector multiplication with 3 vectors .
subroutine, public field_cmult(a, c, n)
Multiplication by constant c .
subroutine fluid_scheme_compressible_log_solver_info(this, params, scheme, lx)
Log comprehensive solver information.
subroutine fluid_scheme_compressible_free(this)
Free allocated memory and cleanup resources.
subroutine fluid_scheme_compressible_update_material_properties(this, time)
Set rho and mu.
subroutine fluid_scheme_compressible_init(this, msh, lx, params, scheme, user)
Initialize common data for compressible fluid scheme.
real(kind=rp) function fluid_scheme_compressible_compute_cfl(this, dt)
Compute CFL number.
subroutine fluid_scheme_compressible_compute_max_wave_speed(this)
Compute maximum wave speed for compressible flows.
subroutine fluid_scheme_compressible_validate(this)
Validate field initialization and compute derived quantities.
subroutine fluid_scheme_compressible_compute_entropy(this)
Compute entropy field S = 1/(gamma-1) * rho * (log(p) - gamma * log(rho))
Utilities for retrieving parameters from the case files.
type(log_t), public neko_log
Global log stream.
integer, parameter, public log_size
real(kind=rp) function, public glsum(a, n)
Sum a vector of length n.
integer, parameter neko_bcknd_device
integer, parameter, public i8
integer, parameter, public rp
Global precision used in computations.
real(kind=rp) function, public cfl_compressible(dt, max_wave_speed, xh, coef, nelv, gdim)
Defines a registry for storing solution fields.
type(registry_t), target, public neko_registry
Global field registry.
Defines a registry for storing and requesting temporary objects This can be used when you have a func...
type(scratch_registry_t), target, public neko_scratch_registry
Global scratch registry.
Defines a function space.
integer, parameter, public gll
Module with things related to the simulation time.
Interfaces for user interaction with NEKO.
Base type of all fluid formulations.
Base type of compressible fluid formulations.
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...