40 use json_module,
only : json_file
71 type(
field_t),
pointer :: max_wave_speed => null()
73 type(
field_t),
pointer :: effective_visc => null()
75 real(kind=
rp) :: gamma
78 integer(kind=i8) :: glb_n_points
80 integer(kind=i8) :: glb_unique_points
91 procedure, pass(this) :: compute_cfl &
97 procedure, pass(this) :: compute_entropy => &
100 procedure, pass(this) :: compute_max_wave_speed => &
103 procedure, pass(this) :: log_solver_info => &
118 type(
mesh_t),
target,
intent(inout) :: msh
119 integer,
intent(in) :: lx
120 character(len=*),
intent(in) :: scheme
121 type(json_file),
target,
intent(inout) :: params
122 type(
user_t),
target,
intent(in) :: user
130 if (msh%gdim .eq. 2)
then
131 call this%Xh%init(
gll, lx, lx)
133 call this%Xh%init(
gll, lx, lx, lx)
136 call this%dm_Xh%init(msh, this%Xh)
138 call this%gs_Xh%init(this%dm_Xh)
140 call this%c_Xh%init(this%gs_Xh)
146 this%params => params
153 call neko_registry%add_field(this%dm_Xh, this%name //
"_rho")
165 call this%m_x%init(this%dm_Xh,
"m_x")
166 call this%m_y%init(this%dm_Xh,
"m_y")
167 call this%m_z%init(this%dm_Xh,
"m_z")
172 call this%E%init(this%dm_Xh,
"E")
176 this%max_wave_speed =>
neko_registry%get_field(
"max_wave_speed")
177 call this%max_wave_speed%init(this%dm_Xh,
"max_wave_speed")
182 call this%S%init(this%dm_Xh,
"S")
186 this%effective_visc =>
neko_registry%get_field(
"effective_visc")
187 call this%effective_visc%init(this%dm_Xh,
"effective_visc")
196 call this%u%init(this%dm_Xh,
"u")
197 call this%v%init(this%dm_Xh,
"v")
198 call this%w%init(this%dm_Xh,
"w")
201 call this%p%init(this%dm_Xh,
"p")
209 call this%f_x%init(this%dm_Xh, fld_name =
"fluid_rhs_x")
210 call this%f_y%init(this%dm_Xh, fld_name =
"fluid_rhs_y")
211 call this%f_z%init(this%dm_Xh, fld_name =
"fluid_rhs_z")
217 this%glb_n_points = int(this%msh%glb_nelv,
i8)*int(this%Xh%lxyz,
i8)
218 this%glb_unique_points = int(
glsum(this%c_Xh%mult, this%dm_Xh%size()),
i8)
223 call this%log_solver_info(params, scheme, lx)
230 call this%dm_Xh%free()
231 call this%gs_Xh%free()
232 call this%c_Xh%free()
235 if (
associated(this%m_x))
then
239 if (
associated(this%m_y))
then
243 if (
associated(this%m_z))
then
247 if (
associated(this%E))
then
251 if (
associated(this%max_wave_speed))
then
252 call this%max_wave_speed%free()
255 if (
associated(this%S))
then
259 if (
associated(this%f_x))
then
264 if (
associated(this%f_y))
then
269 if (
associated(this%f_z))
then
282 nullify(this%max_wave_speed)
300 integer :: temp_indices(1)
302 n = this%dm_Xh%size()
312 call field_cmult2(this%E, this%p, 1.0_rp/(this%gamma - 1.0_rp), n)
323 call this%compute_max_wave_speed()
333 real(kind=
rp),
intent(in) :: dt
337 associate(u => this%u, v => this%v, w => this%w, p => this%p, &
338 rho => this%rho, xh => this%Xh, c_xh => this%c_Xh, &
339 msh => this%msh, gamma => this%gamma, &
340 max_wave_speed => this%max_wave_speed)
342 n = xh%lx * xh%ly * xh%lz * msh%nelv
354 type(time_state_t),
intent(in) :: time
363 n = this%S%dof%size()
366 if (neko_bcknd_device .eq. 1)
then
367 call compressible_ops_device_compute_entropy(this%S, this%p, this%rho, &
370 call compressible_ops_cpu_compute_entropy(this%S%x, this%p%x, &
371 this%rho%x, this%gamma, n)
382 n = this%u%dof%size()
385 if (neko_bcknd_device .eq. 1)
then
386 call compressible_ops_device_compute_max_wave_speed( &
387 this%max_wave_speed, this%u, this%v, this%w, this%gamma, this%p, &
390 call compressible_ops_cpu_compute_max_wave_speed(this%max_wave_speed%x, &
391 this%u%x, this%v%x, this%w%x, this%gamma, this%p%x, this%rho%x, n)
403 type(json_file),
intent(inout) :: params
404 character(len=*),
intent(in) :: scheme
405 integer,
intent(in) :: lx
406 character(len=LOG_SIZE) :: log_buf
407 logical :: logical_val
408 real(kind=rp) :: real_val
409 integer :: integer_val
411 call neko_log%section(
'Fluid')
412 write(log_buf,
'(A, A)')
'Type : ', trim(scheme)
413 call neko_log%message(log_buf)
414 write(log_buf,
'(A, A)')
'Name : ', trim(this%name)
415 call neko_log%message(log_buf)
419 write(log_buf,
'(A, I1)')
'Poly order : ', lx-1
420 else if (lx .ge. 10)
then
421 write(log_buf,
'(A, I2)')
'Poly order : ', lx-1
423 write(log_buf,
'(A, I3)')
'Poly order : ', lx-1
425 call neko_log%message(log_buf)
428 write(log_buf,
'(A, I0)')
'GLL points : ', this%glb_n_points
429 call neko_log%message(log_buf)
430 write(log_buf,
'(A, I0)')
'Unique pts.: ', this%glb_unique_points
431 call neko_log%message(log_buf)
434 write(log_buf,
'(A,ES13.6)')
'gamma :', this%gamma
435 call neko_log%message(log_buf)
438 call json_get_or_default(params,
'case.numerics.c_avisc_low', real_val, &
440 write(log_buf,
'(A,ES13.6)')
'c_avisc_low:', real_val
441 call neko_log%message(log_buf)
443 call json_get_or_default(params,
'case.numerics.time_order', integer_val, 4)
444 write(log_buf,
'(A, I0)')
'RK order : ', integer_val
445 call neko_log%message(log_buf)
446 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...