Neko 1.99.9
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
entropy_viscosity.f90
Go to the documentation of this file.
1! Copyright (c) 2025-2026, 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!
35 use num_types, only : rp
36 use case, only : case_t
37 use utils, only : neko_error
38 use registry, only : neko_registry
40 use json_module, only : json_file
42 use field, only : field_t
45 use coefs, only : coef_t
46 use dofmap, only : dofmap_t
47 use gather_scatter, only : gs_t
48 use time_state, only : time_state_t
50 use operators, only : div
51 use math, only : glmax, absval, col2
53 use mesh, only : mesh_t
54 use space, only : space_t
55 use gather_scatter, only : gs_t
56 use gs_ops, only : gs_op_add
65 use entropy_viscosity_device, only : &
74 implicit none
75 private
76
78 type, public, extends(avm_t) :: entropy_viscosity_t
80 real(kind=rp) :: c_avisc_entropy
82 real(kind=rp) :: c_avisc_low
84 real(kind=rp) :: gamma
86 type(field_t) :: entropy_residual
88 type(field_series_t) :: s_lag
90 type(field_t), pointer :: s => null()
92 type(field_t), pointer :: p => null()
94 type(field_t), pointer :: rho => null()
96 type(field_t), pointer :: u => null()
98 type(field_t), pointer :: v => null()
100 type(field_t), pointer :: w => null()
102 type(field_t) :: h
104 type(field_t), pointer :: max_wave_speed => null()
106 type(mesh_t), pointer :: msh => null()
108 type(space_t), pointer :: xh => null()
110 type(gs_t), pointer :: gs => null()
111 contains
113 procedure, pass(this) :: init => entropy_viscosity_init
115 procedure, pass(this) :: free => entropy_viscosity_free
117 procedure, pass(this) :: preprocess => entropy_viscosity_preprocess
119 procedure, pass(this) :: compute => entropy_viscosity_update_lag
121 procedure, pass(this) :: restart => entropy_viscosity_restart
123 procedure, pass(this) :: compute_h => entropy_viscosity_compute_h
125 procedure, pass(this) :: set_fields => entropy_viscosity_set_fields
127 procedure, pass(this) :: compute_entropy => &
130 procedure, pass(this), private :: compute_residual => &
133 procedure, pass(this), private :: compute_viscosity => &
136 procedure, pass(this), private :: smooth_viscosity => &
139 procedure, pass(this), private :: apply_element_max => &
142 procedure, pass(this), private :: low_order_viscosity => &
144 end type entropy_viscosity_t
145
146contains
147
152 subroutine entropy_viscosity_init(this, case, json)
153 class(entropy_viscosity_t), intent(inout) :: this
154 type(json_file), intent(inout) :: json
155 class(case_t), intent(inout), target :: case
156 character(len=:), allocatable :: reg_coeff_name
157
158 call this%free()
159
160 select type (fluid => case%fluid)
162 call this%set_fields(fluid%p, fluid%rho, fluid%u, fluid%v, &
163 fluid%w, fluid%max_wave_speed, fluid%msh, fluid%Xh, fluid%gs_Xh, &
164 fluid%gamma)
165 class default
166 call neko_error('Entropy viscosity requires a compressible fluid scheme')
167 end select
168
169 call json_get_or_default(json, 'field_name', &
170 reg_coeff_name, "entropy_viscosity")
171 call this%init_base(case%fluid%dm_Xh, case%fluid%c_Xh, trim(reg_coeff_name))
172 if (allocated(reg_coeff_name)) deallocate(reg_coeff_name)
173
174 call json_get_or_default(json, 'c_avisc_low', this%c_avisc_low, 0.5_rp)
175 call json_get_or_default(json, 'c_avisc_entropy', &
176 this%c_avisc_entropy, 1.0_rp)
177
178 call this%entropy_residual%init(this%dof, 'entropy_residual')
179
180 call neko_registry%add_field(this%dof, 'S', .true.)
181 this%S => neko_registry%get_field('S')
182 call this%compute_entropy()
183 call this%S_lag%init(this%S, 3)
184
185 call this%h%init(this%dof, 'h')
186 call this%compute_h()
187
188 end subroutine entropy_viscosity_init
189
192 subroutine entropy_viscosity_free(this)
193 class(entropy_viscosity_t), intent(inout) :: this
194
195 call this%free_base()
196 call this%entropy_residual%free()
197 call this%S_lag%free()
198 call this%h%free()
199
200 nullify(this%S)
201 nullify(this%p)
202 nullify(this%rho)
203 nullify(this%u)
204 nullify(this%v)
205 nullify(this%w)
206 nullify(this%max_wave_speed)
207 nullify(this%msh)
208 nullify(this%Xh)
209 nullify(this%gs)
210
211 end subroutine entropy_viscosity_free
212
216 subroutine entropy_viscosity_preprocess(this, time)
217 class(entropy_viscosity_t), intent(inout) :: this
218 type(time_state_t), intent(in) :: time
219
220 call this%compute_residual(time%tstep, &
221 real(time%dt, kind=rp), &
222 real(time%dtlag, kind=rp))
223
224 call this%compute_viscosity(time%tstep)
225
226 end subroutine entropy_viscosity_preprocess
227
233 subroutine entropy_viscosity_compute_residual(this, tstep, dt, dt_lag)
234 class(entropy_viscosity_t), intent(inout) :: this
235 integer, intent(in) :: tstep
236 real(kind=rp), intent(in) :: dt
237 real(kind=rp), intent(in) :: dt_lag(10)
238 integer :: n
239 type(field_t), pointer :: us_field, vs_field, ws_field, div_field
240 integer :: temp_indices(4)
241 real(kind=rp) :: bdf_coeffs(4)
242 type(bdf_time_scheme_t) :: bdf_scheme
243 real(kind=rp) :: dt_local(10)
244
245 if (tstep .le. 3) then
246 return
247 end if
248
249 n = this%dof%size()
250 call field_cfill(this%entropy_residual, 0.0_rp, n)
251
252 bdf_coeffs = 0.0_rp
253 dt_local = dt_lag
254
255 call bdf_scheme%compute_coeffs(bdf_coeffs, dt_local, 3)
256
257 if (neko_bcknd_device .eq. 1) then
259 this%entropy_residual%x_d, &
260 this%S%x_d, this%S_lag%lf(1)%x_d, &
261 this%S_lag%lf(2)%x_d, this%S_lag%lf(3)%x_d, &
262 bdf_coeffs, dt, n)
263 else
265 this%entropy_residual%x, &
266 this%S%x, this%S_lag%lf(1)%x, &
267 this%S_lag%lf(2)%x, this%S_lag%lf(3)%x, &
268 bdf_coeffs, dt, n)
269 end if
270
271 call neko_scratch_registry%request_field(us_field, temp_indices(1), .false.)
272 call neko_scratch_registry%request_field(vs_field, temp_indices(2), .false.)
273 call neko_scratch_registry%request_field(ws_field, temp_indices(3), .false.)
274 call neko_scratch_registry%request_field(div_field, temp_indices(4), &
275 .false.)
276
277 if (neko_bcknd_device .eq. 1) then
278 call device_col3(us_field%x_d, this%u%x_d, this%S%x_d, n)
279 call device_col3(vs_field%x_d, this%v%x_d, this%S%x_d, n)
280 call device_col3(ws_field%x_d, this%w%x_d, this%S%x_d, n)
281 else
282 call entropy_viscosity_col3_vector_cpu(us_field%x, vs_field%x, &
283 ws_field%x, this%u%x, this%v%x, this%w%x, this%S%x, n)
284 end if
285
286 call div(div_field%x, us_field%x, vs_field%x, ws_field%x, this%coef)
287
288 if (neko_bcknd_device .eq. 1) then
289 call device_memcpy(this%entropy_residual%x, this%entropy_residual%x_d, &
290 n, device_to_host, sync = .false.)
291 call device_memcpy(div_field%x, div_field%x_d, n, device_to_host, &
292 sync = .true.)
293 end if
294
295 call entropy_viscosity_abs_add_cpu(this%entropy_residual%x, div_field%x, n)
296
297 if (neko_bcknd_device .eq. 1) then
298 call device_memcpy(this%entropy_residual%x, this%entropy_residual%x_d, &
299 n, host_to_device, sync = .false.)
300 end if
301
302 call neko_scratch_registry%relinquish_field(temp_indices)
303
305
310 class(entropy_viscosity_t), intent(inout) :: this
311 integer, intent(in) :: tstep
312 integer :: n, temp_indices(1)
313 real(kind=rp) :: s_mean, n_s
314 type(field_t), pointer :: temp_field
315
316 n = this%dof%size()
317
318 if (tstep .le. 3) then
319 call field_cfill(this%reg_coeff, 0.0_rp, n)
320 return
321 end if
322
323 call neko_scratch_registry%request_field(temp_field, temp_indices(1), &
324 .false.)
325
326 call field_cfill(temp_field, 1.0_rp, n)
327 s_mean = field_glsum(this%S, n) / field_glsum(temp_field, n)
328
329 call field_copy(temp_field, this%S, n)
330 call field_cadd(temp_field, -s_mean, n)
331
332 if (neko_bcknd_device .eq. 1) then
333 call device_absval(temp_field%x_d, n)
334 call device_memcpy(temp_field%x, temp_field%x_d, n, device_to_host, &
335 sync = .true.)
336 else
337 call absval(temp_field%x, n)
338 end if
339
340 ! Normalization factor n_S = |S-S_mean|_inf
341 n_s = glmax(temp_field%x, n)
342
343 call neko_scratch_registry%relinquish_field(temp_indices)
344
345 if (n_s < 1.0e-12_rp) then
346 n_s = 1.0e-12_rp
347 end if
348
349 ! entropy viscosity = c_avisc_entropy * h^2 * entropy_residual / n_S
350 if (neko_bcknd_device .eq. 1) then
352 this%reg_coeff%x_d, this%entropy_residual%x_d, &
353 this%h%x_d, this%c_avisc_entropy, n_s, n)
354 else
356 this%reg_coeff%x, this%entropy_residual%x, &
357 this%h%x, this%c_avisc_entropy, n_s, n)
358 end if
359
360 ! artificial viscosity = min(entropy viscosity, low-order viscosity)
361 if (neko_bcknd_device .eq. 1) then
363 this%reg_coeff%x_d, this%h%x_d, this%max_wave_speed%x_d, &
364 this%c_avisc_low, n)
365 else
367 this%reg_coeff%x, this%h%x, this%max_wave_speed%x, &
368 this%c_avisc_low, n)
369 end if
370
371 call this%apply_element_max()
372
373 call this%smooth_viscosity()
374
376
381 class(entropy_viscosity_t), intent(inout) :: this
382 integer :: n
383 type(field_t), pointer :: temp_field, mult_field
384 integer :: temp_indices(2)
385
386 n = this%dof%size()
387
388 call neko_scratch_registry%request_field(temp_field, temp_indices(1), &
389 .false.)
390 call neko_scratch_registry%request_field(mult_field, temp_indices(2), &
391 .false.)
392
393 call field_copy(temp_field, this%reg_coeff, n)
394 call this%gs%op(temp_field, gs_op_add)
395
396 call field_cfill(mult_field, 1.0_rp, n)
397 call this%gs%op(mult_field, gs_op_add)
398
399 if (neko_bcknd_device .eq. 1) then
401 this%reg_coeff%x_d, temp_field%x_d, mult_field%x_d, n)
402 else
404 this%reg_coeff%x, temp_field%x, mult_field%x, n)
405 end if
406
407 call neko_scratch_registry%relinquish_field(temp_indices)
408
410
414 class(entropy_viscosity_t), intent(inout) :: this
415 integer :: lx
416
417 lx = this%Xh%lx
418
419 if (neko_bcknd_device .eq. 1) then
421 this%reg_coeff%x_d, lx, this%msh%nelv)
422 else
424 this%reg_coeff%x, lx, this%msh%nelv)
425 end if
426
428
441 subroutine entropy_viscosity_set_fields(this, p, rho, u, v, w, &
442 max_wave_speed, msh, Xh, gs, gamma)
443 class(entropy_viscosity_t), intent(inout) :: this
444 type(field_t), target, intent(in) :: p, rho, u, v, w, max_wave_speed
445 type(mesh_t), target, intent(in) :: msh
446 type(space_t), target, intent(in) :: Xh
447 type(gs_t), target, intent(in) :: gs
448 real(kind=rp), intent(in) :: gamma
449
450 this%p => p
451 this%rho => rho
452 this%u => u
453 this%v => v
454 this%w => w
455 this%max_wave_speed => max_wave_speed
456 this%msh => msh
457 this%Xh => xh
458 this%gs => gs
459 this%gamma = gamma
460
461 end subroutine entropy_viscosity_set_fields
462
466 class(entropy_viscosity_t), intent(inout) :: this
467 integer :: n
468
469 n = this%dof%size()
470
471 if (neko_bcknd_device .eq. 1) then
472 call compressible_ops_device_compute_entropy(this%S, this%p, this%rho, &
473 this%gamma, n)
474 else
475 call compressible_ops_cpu_compute_entropy(this%S%x, this%p%x, &
476 this%rho%x, this%gamma, n)
477 end if
478
480
484 subroutine entropy_viscosity_restart(this, time)
485 class(entropy_viscosity_t), intent(inout) :: this
486 type(time_state_t), intent(in) :: time
487
488 call this%compute_entropy()
489 call this%S_lag%set(this%S)
490
491 end subroutine entropy_viscosity_restart
492
496 subroutine entropy_viscosity_update_lag(this, time)
497 class(entropy_viscosity_t), intent(inout) :: this
498 type(time_state_t), intent(in) :: time
499
500 call this%S_lag%update()
501 call this%compute_entropy()
502
503
504 end subroutine entropy_viscosity_update_lag
505
515 subroutine entropy_viscosity_col3_vector_cpu(us, vs, ws, u, v, w, S, n)
516 integer, intent(in) :: n
517 real(kind=rp), intent(out) :: us(n), vs(n), ws(n)
518 real(kind=rp), intent(in) :: u(n), v(n), w(n), s(n)
519 integer :: i
520
521 !OCL NORECURRENCE, NOVREC, NOALIAS
522 !DIR$ CONCURRENT
523 !DIR$ IVDEP
524 !GCC$ ivdep
525 !$omp parallel do simd
526 do i = 1, n
527 us(i) = u(i) * s(i)
528 vs(i) = v(i) * s(i)
529 ws(i) = w(i) * s(i)
530 end do
531 !$omp end parallel do simd
533
538 subroutine entropy_viscosity_abs_add_cpu(entropy_residual, div_field, n)
539 integer, intent(in) :: n
540 real(kind=rp), intent(inout) :: entropy_residual(n)
541 real(kind=rp), intent(in) :: div_field(n)
542 integer :: i
543
544 !OCL NORECURRENCE, NOVREC, NOALIAS
545 !DIR$ CONCURRENT
546 !DIR$ IVDEP
547 !GCC$ ivdep
548 !$omp parallel do simd
549 do i = 1, n
550 entropy_residual(i) = abs(entropy_residual(i) + div_field(i))
551 end do
552 !$omp end parallel do simd
553 end subroutine entropy_viscosity_abs_add_cpu
554
559 pure function entropy_viscosity_low_order(this, i) result(visc)
560 class(entropy_viscosity_t), intent(in) :: this
561 integer, intent(in) :: i
562 real(kind=rp) :: visc
563
564 visc = this%c_avisc_low * this%h%x(i,1,1,1) * this%max_wave_speed%x(i,1,1,1)
565
566 end function entropy_viscosity_low_order
567
568
574 class(entropy_viscosity_t), intent(inout) :: this
575 integer :: e, i, j, k
576 integer :: im, ip, jm, jp, km, kp
577 real(kind=rp) :: di, dj, dk, ndim_inv
578 integer :: lx_half, ly_half, lz_half
579
580 lx_half = this%coef%Xh%lx / 2
581 ly_half = this%coef%Xh%ly / 2
582 lz_half = this%coef%Xh%lz / 2
583
584 do concurrent(e = 1:this%coef%msh%nelv)
585 do concurrent(k = 1:this%coef%Xh%lz, &
586 j = 1:this%coef%Xh%ly, i = 1:this%coef%Xh%lx)
587 km = max(1, k-1)
588 kp = min(this%coef%Xh%lz, k+1)
589
590 jm = max(1, j-1)
591 jp = min(this%coef%Xh%ly, j+1)
592
593 im = max(1, i-1)
594 ip = min(this%coef%Xh%lx, i+1)
595
596 di = (this%coef%dof%x%x(ip, j, k, e) - &
597 this%coef%dof%x%x(im, j, k, e))**2 &
598 + (this%coef%dof%y%x(ip, j, k, e) - &
599 this%coef%dof%y%x(im, j, k, e))**2 &
600 + (this%coef%dof%z%x(ip, j, k, e) - &
601 this%coef%dof%z%x(im, j, k, e))**2
602
603 dj = (this%coef%dof%x%x(i, jp, k, e) - &
604 this%coef%dof%x%x(i, jm, k, e))**2 &
605 + (this%coef%dof%y%x(i, jp, k, e) - &
606 this%coef%dof%y%x(i, jm, k, e))**2 &
607 + (this%coef%dof%z%x(i, jp, k, e) - &
608 this%coef%dof%z%x(i, jm, k, e))**2
609
610 dk = (this%coef%dof%x%x(i, j, kp, e) - &
611 this%coef%dof%x%x(i, j, km, e))**2 &
612 + (this%coef%dof%y%x(i, j, kp, e) - &
613 this%coef%dof%y%x(i, j, km, e))**2 &
614 + (this%coef%dof%z%x(i, j, kp, e) - &
615 this%coef%dof%z%x(i, j, km, e))**2
616
617 di = sqrt(di) / (ip - im)
618 dj = sqrt(dj) / (jp - jm)
619 dk = sqrt(dk) / (kp - km)
620 this%h%x(i,j,k,e) = (di * dj * dk)**(1.0_rp / 3.0_rp)
621
622 end do
623 end do
624
625 if (neko_bcknd_device .eq. 1) then
626 call device_memcpy(this%h%x, this%h%x_d, this%h%dof%size(),&
627 host_to_device, sync = .false.)
628 call this%gs%op(this%h, gs_op_add)
629 call device_col2(this%h%x_d, this%coef%mult_d, this%h%dof%size())
630 else
631 call this%gs%op(this%h, gs_op_add)
632 call col2(this%h%x, this%coef%mult, this%h%dof%size())
633 end if
634
635 end subroutine entropy_viscosity_compute_h
636
637end module entropy_viscosity
Copy data between host and device (or device and device)
Definition device.F90:72
Retrieves a parameter by name or assigns a provided default value. In the latter case also adds the m...
Compute the divergence of a vector field.
Definition operators.f90:86
Implements avm_t.
Definition avm.f90:35
Backward-differencing scheme for time integration.
Defines a simulation case.
Definition case.f90:34
Coefficients.
Definition coef.f90:34
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.
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.
real(kind=rp) function, public device_glsum(a_d, n, strm)
Sum a vector of length n.
subroutine, public device_col2(a_d, b_d, n, strm)
Vector multiplication .
subroutine, public device_absval(a_d, n, strm)
subroutine, public device_col3(a_d, b_d, c_d, n, strm)
Vector multiplication with 3 vectors .
Device abstraction, common interface for various accelerators.
Definition device.F90:34
integer, parameter, public host_to_device
Definition device.F90:48
integer, parameter, public device_to_host
Definition device.F90:48
Defines a mapping of the degrees of freedom.
Definition dofmap.f90:35
subroutine compute_h(h, zgml, gdim, lx)
Definition dofmap.f90:1230
CPU backend for entropy viscosity regularization.
subroutine, public entropy_viscosity_compute_viscosity_cpu(reg_coeff, entropy_residual, h, c_avisc_entropy, n_s, n)
Compute viscosity from entropy residual on CPU.
subroutine, public entropy_viscosity_compute_residual_cpu(entropy_residual, s, s_lag1, s_lag2, s_lag3, bdf_coeffs, dt, n)
Compute entropy residual on CPU.
subroutine, public entropy_viscosity_smooth_divide_cpu(reg_coeff, temp_field, mult_field, n)
Divide by multiplicity for smoothing on CPU.
subroutine, public entropy_viscosity_clamp_to_low_order_cpu(reg_coeff, h, max_wave_speed, c_avisc_low, n)
Clamp regularization coefficient to low-order viscosity on CPU.
subroutine, public entropy_viscosity_apply_element_max_cpu(reg_coeff, lx, nelv)
Apply element-wise maximum on CPU.
Device backend for entropy viscosity regularization.
subroutine, public entropy_viscosity_smooth_divide_device(reg_coeff_d, temp_field_d, mult_field_d, n)
Divide by gather-scatter multiplicity on a device.
subroutine, public entropy_viscosity_clamp_to_low_order_device(reg_coeff_d, h_d, max_wave_speed_d, c_avisc_low, n)
Clamp the coefficient to low-order viscosity on a device.
subroutine, public entropy_viscosity_apply_element_max_device(reg_coeff_d, lx, nelv)
Apply the element-wise maximum on a device.
subroutine, public entropy_viscosity_compute_residual_device(entropy_residual_d, s_d, s_lag1_d, s_lag2_d, s_lag3_d, bdf_coeffs, dt, n)
Compute entropy residual on a device.
subroutine, public entropy_viscosity_compute_viscosity_device(reg_coeff_d, entropy_residual_d, h_d, c_avisc_entropy, n_s, n)
Compute viscosity from an entropy residual on a device.
Implements the entropy-based artificial viscosity model.
subroutine entropy_viscosity_apply_element_max(this)
Replace nodal viscosity values by the maximum in each element.
subroutine entropy_viscosity_abs_add_cpu(entropy_residual, div_field, n)
Add the flux divergence to the residual and take its absolute value.
subroutine entropy_viscosity_col3_vector_cpu(us, vs, ws, u, v, w, s, n)
Multiply each velocity component by entropy on the CPU.
subroutine entropy_viscosity_compute_h(this)
Compute the characteristic mesh size. Adapted from les_model_compute_delta in les_model....
subroutine entropy_viscosity_smooth_viscosity(this)
Cross-element smoothing via gather-scatter averaging. Averages viscosity values at shared nodes betwe...
subroutine entropy_viscosity_preprocess(this, time)
Compute the artificial viscosity before a time step.
subroutine entropy_viscosity_compute_viscosity(this, tstep)
Compute and limit the entropy viscosity coefficient.
subroutine entropy_viscosity_compute_residual(this, tstep, dt, dt_lag)
Compute the BDF entropy residual.
subroutine entropy_viscosity_update_lag(this, time)
Shift the entropy history and compute the new entropy.
subroutine entropy_viscosity_init(this, case, json)
Initialize the entropy viscosity model from a case and JSON parameters.
subroutine entropy_viscosity_free(this)
Free the entropy viscosity model.
subroutine entropy_viscosity_restart(this, time)
Reinitialize entropy history from a restarted flow state.
subroutine entropy_viscosity_compute_entropy(this)
Compute entropy from the current pressure and density.
pure real(kind=rp) function entropy_viscosity_low_order(this, i)
Compute low-order viscosity at one point.
subroutine entropy_viscosity_set_fields(this, p, rho, u, v, w, max_wave_speed, msh, xh, gs, gamma)
Associate the fields and discretization used by the model.
subroutine, public field_cadd(a, s, n)
Add a scalar to vector .
subroutine, public field_cfill(a, c, n)
Set all elements to a constant c .
real(kind=rp) function, public field_glsum(a, n)
subroutine, public field_copy(a, b, n)
Copy a vector .
Contains the field_serties_t type.
Defines a field.
Definition field.f90:34
Gather-scatter.
Defines Gather-scatter operations.
Definition gs_ops.f90:34
integer, parameter, public gs_op_add
Definition gs_ops.f90:36
Utilities for retrieving parameters from the case files.
Definition math.f90:60
subroutine, public absval(a, n)
Take the absolute value of an array.
Definition math.f90:1679
subroutine, public col2(a, b, n)
Vector multiplication .
Definition math.f90:1085
real(kind=rp) function, public glmax(a, n)
Max of a vector of length n.
Definition math.f90:654
Defines a mesh.
Definition mesh.f90:34
Build configurations.
integer, parameter neko_bcknd_device
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:14
Operators.
Definition operators.f90:34
Defines a registry for storing solution fields.
Definition registry.f90:34
type(registry_t), target, public neko_registry
Global field registry.
Definition registry.f90:158
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.
Definition space.f90:34
Module with things related to the simulation time.
Utilities.
Definition utils.f90:35
Base abstract type for artificial viscosity models.
Definition avm.f90:48
Implicit backward-differencing scheme for time integration.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Definition coef.f90:135
Entropy-based artificial viscosity model for compressible flow.
Stores a series (sequence) of fields, logically connected to a base field, and arranged according to ...
Gather-scatter kernel.
The function space for the SEM solution fields.
Definition space.f90:64
A struct that contains all info about the time, expand as needed.
#define max(a, b)
Definition tensor.cu:40