Skip to content

Commit

Permalink
Merge pull request #1616 from Shiyu-Sandy-Du/LES_error_message
Browse files Browse the repository at this point in the history
Warning when performing LES
timofeymukha authored Dec 13, 2024
2 parents 35a73bd + 413e821 commit 70a4942
Showing 8 changed files with 69 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/.depends
Original file line number Diff line number Diff line change
@@ -288,7 +288,7 @@ simulation_components/spectral_error.lo : simulation_components/spectral_error.f
simulation_components/lambda2.lo : simulation_components/lambda2.f90 device/device.lo simulation_components/field_writer.lo case.lo math/operators.lo field/field.lo field/field_registry.lo simulation_components/simulation_component.lo config/num_types.lo
simulation_components/weak_grad.lo : simulation_components/weak_grad.f90 simulation_components/field_writer.lo common/json_utils.lo io/fld_file_output.lo case.lo math/operators.lo field/field.lo field/field_registry.lo simulation_components/simulation_component.lo config/num_types.lo
simulation_components/derivative.lo : simulation_components/derivative.f90 common/utils.lo simulation_components/field_writer.lo common/json_utils.lo io/fld_file_output.lo case.lo math/operators.lo field/field.lo field/field_registry.lo simulation_components/simulation_component.lo config/num_types.lo
simulation_components/les_simcomp.lo : simulation_components/les_simcomp.f90 simulation_components/field_writer.lo common/json_utils.lo les/les_model.lo case.lo simulation_components/simulation_component.lo config/num_types.lo
simulation_components/les_simcomp.lo : simulation_components/les_simcomp.f90 common/utils.lo simulation_components/field_writer.lo common/json_utils.lo les/les_model.lo case.lo simulation_components/simulation_component.lo config/num_types.lo
simulation_components/simulation_component_fctry.lo : simulation_components/simulation_component_fctry.f90 simulation_components/spectral_error.lo simulation_components/derivative.lo simulation_components/weak_grad.lo simulation_components/field_writer.lo common/utils.lo simulation_components/les_simcomp.lo simulation_components/probes.lo simulation_components/lambda2.lo simulation_components/fluid_stats_simcomp.lo simulation_components/force_torque.lo simulation_components/vorticity.lo simulation_components/simulation_component.lo
source_terms/source_term.lo : source_terms/source_term.f90 field/field_list.lo sem/coef.lo config/num_types.lo
source_terms/coriolis_source_term.lo : source_terms/coriolis_source_term.f90 source_terms/bcknd/cpu/coriolis_source_term_cpu.lo common/utils.lo config/neko_config.lo sem/coef.lo source_terms/source_term.lo common/json_utils.lo field/field_list.lo config/num_types.lo
@@ -310,21 +310,21 @@ source_terms/bcknd/device/hip/hip_filters.lo : source_terms/bcknd/device/hip/hip
source_terms/bcknd/device/opencl/opencl_filters.lo : source_terms/bcknd/device/opencl/opencl_filters.f90 config/num_types.lo
les/les_model.lo : les/les_model.f90 math/bcknd/device/device_math.lo math/math.lo device/device.lo config/neko_config.lo gs/gs_ops.lo sem/coef.lo sem/dofmap.lo field/field_registry.lo field/field.lo config/num_types.lo
les/les_model_fctry.lo : les/les_model_fctry.f90 common/utils.lo les/sigma.lo les/dynamic_smagorinsky.lo les/smagorinsky.lo les/vreman.lo les/les_model.lo
les/vreman.lo : les/vreman.f90 sem/coef.lo les/bcknd/device/vreman_device.lo les/bcknd/cpu/vreman_cpu.lo config/neko_config.lo common/utils.lo common/json_utils.lo sem/dofmap.lo les/les_model.lo field/field.lo config/num_types.lo
les/vreman.lo : les/vreman.f90 common/log.lo sem/coef.lo les/bcknd/device/vreman_device.lo les/bcknd/cpu/vreman_cpu.lo config/neko_config.lo common/utils.lo common/json_utils.lo sem/dofmap.lo les/les_model.lo field/field.lo config/num_types.lo
les/bcknd/cpu/vreman_cpu.lo : les/bcknd/cpu/vreman_cpu.f90 gs/gs_ops.lo sem/coef.lo math/operators.lo field/field.lo field/field_registry.lo field/scratch_registry.lo math/math.lo field/field_list.lo config/num_types.lo
les/bcknd/device/vreman_device.lo : les/bcknd/device/vreman_device.f90 les/bcknd/device/device_vreman_nut.lo gs/gs_ops.lo sem/coef.lo math/operators.lo field/field.lo field/field_registry.lo field/scratch_registry.lo math/math.lo config/num_types.lo
les/bcknd/device/device_vreman_nut.lo : les/bcknd/device/device_vreman_nut.F90 comm/comm.lo common/utils.lo config/num_types.lo
les/smagorinsky.lo : les/smagorinsky.f90 sem/coef.lo les/bcknd/device/smagorinsky_device.lo les/bcknd/cpu/smagorinsky_cpu.lo config/neko_config.lo common/utils.lo common/json_utils.lo sem/dofmap.lo les/les_model.lo field/field.lo config/num_types.lo
les/smagorinsky.lo : les/smagorinsky.f90 common/log.lo sem/coef.lo les/bcknd/device/smagorinsky_device.lo les/bcknd/cpu/smagorinsky_cpu.lo config/neko_config.lo common/utils.lo common/json_utils.lo sem/dofmap.lo les/les_model.lo field/field.lo config/num_types.lo
les/bcknd/cpu/smagorinsky_cpu.lo : les/bcknd/cpu/smagorinsky_cpu.f90 gs/gs_ops.lo sem/coef.lo math/operators.lo field/field.lo field/field_registry.lo field/scratch_registry.lo field/field_list.lo config/num_types.lo
les/bcknd/device/smagorinsky_device.lo : les/bcknd/device/smagorinsky_device.f90 les/bcknd/device/device_smagorinsky_nut.lo math/bcknd/device/device_math.lo gs/gs_ops.lo sem/coef.lo math/operators.lo field/field.lo field/field_registry.lo field/scratch_registry.lo field/field_list.lo config/num_types.lo
les/bcknd/device/device_smagorinsky_nut.lo : les/bcknd/device/device_smagorinsky_nut.F90 comm/comm.lo common/utils.lo config/num_types.lo
les/dynamic_smagorinsky.lo : les/dynamic_smagorinsky.f90 les/bcknd/device/dynamic_smagorinsky_device.lo les/bcknd/cpu/dynamic_smagorinsky_cpu.lo les/elementwise_filter.lo sem/coef.lo config/neko_config.lo common/utils.lo common/json_utils.lo sem/dofmap.lo les/les_model.lo field/field.lo field/field_list.lo math/math.lo config/num_types.lo
les/dynamic_smagorinsky.lo : les/dynamic_smagorinsky.f90 les/bcknd/device/dynamic_smagorinsky_device.lo common/log.lo les/bcknd/cpu/dynamic_smagorinsky_cpu.lo les/elementwise_filter.lo sem/coef.lo config/neko_config.lo common/utils.lo common/json_utils.lo sem/dofmap.lo les/les_model.lo field/field.lo field/field_list.lo math/math.lo config/num_types.lo
les/bcknd/cpu/dynamic_smagorinsky_cpu.lo : les/bcknd/cpu/dynamic_smagorinsky_cpu.f90 gs/gs_ops.lo les/elementwise_filter.lo sem/coef.lo math/operators.lo field/field.lo field/field_registry.lo field/scratch_registry.lo math/math.lo field/field_list.lo config/num_types.lo
les/bcknd/device/dynamic_smagorinsky_device.lo : les/bcknd/device/dynamic_smagorinsky_device.f90 les/bcknd/device/device_dynamic_smagorinsky_nut.lo math/bcknd/device/device_math.lo gs/gs_ops.lo les/elementwise_filter.lo sem/coef.lo math/operators.lo field/field.lo field/field_registry.lo field/scratch_registry.lo field/field_list.lo config/num_types.lo
les/bcknd/device/device_dynamic_smagorinsky_nut.lo : les/bcknd/device/device_dynamic_smagorinsky_nut.F90 comm/comm.lo common/utils.lo config/num_types.lo
les/elementwise_filter.lo : les/elementwise_filter.f90 math/bcknd/device/device_math.lo device/device.lo math/tensor.lo les/bcknd/cpu/elementwise_filter_cpu.lo config/neko_config.lo common/utils.lo field/field.lo math/math.lo config/num_types.lo
les/bcknd/cpu/elementwise_filter_cpu.lo : les/bcknd/cpu/elementwise_filter_cpu.f90 math/mxm_wrapper.lo math/tensor.lo math/matrix.lo sem/speclib.lo math/math.lo config/num_types.lo
les/sigma.lo : les/sigma.f90 sem/coef.lo les/bcknd/device/sigma_device.lo les/bcknd/cpu/sigma_cpu.lo config/neko_config.lo common/utils.lo common/json_utils.lo sem/dofmap.lo les/les_model.lo field/field.lo config/num_types.lo
les/sigma.lo : les/sigma.f90 common/log.lo sem/coef.lo les/bcknd/device/sigma_device.lo les/bcknd/cpu/sigma_cpu.lo config/neko_config.lo common/utils.lo common/json_utils.lo sem/dofmap.lo les/les_model.lo field/field.lo config/num_types.lo
les/bcknd/cpu/sigma_cpu.lo : les/bcknd/cpu/sigma_cpu.f90 math/math.lo gs/gs_ops.lo sem/coef.lo math/operators.lo field/field.lo field/field_registry.lo field/scratch_registry.lo field/field_list.lo config/num_types.lo
les/bcknd/device/sigma_device.lo : les/bcknd/device/sigma_device.f90 les/bcknd/device/device_sigma_nut.lo gs/gs_ops.lo sem/coef.lo math/operators.lo field/field.lo field/field_registry.lo field/scratch_registry.lo math/math.lo math/bcknd/device/device_math.lo field/field_list.lo config/num_types.lo
les/bcknd/device/device_sigma_nut.lo : les/bcknd/device/device_sigma_nut.F90 comm/comm.lo common/utils.lo config/num_types.lo
5 changes: 4 additions & 1 deletion src/fluid/fluid_scheme.f90
Original file line number Diff line number Diff line change
@@ -396,6 +396,9 @@ subroutine fluid_scheme_init_common(this, msh, lx, params, scheme, user, &
write(log_buf, '(A, L1)') 'Dealias : ', logical_val
call neko_log%message(log_buf)

write(log_buf, '(A, L1)') 'LES : ', this%variable_material_properties
call neko_log%message(log_buf)

call json_get_or_default(params, 'case.output_boundary', logical_val, &
.false.)
write(log_buf, '(A, L1)') 'Save bdry : ', logical_val
@@ -540,7 +543,7 @@ subroutine fluid_scheme_init_common(this, msh, lx, params, scheme, user, &
call json_extract_object(params, 'case.fluid.wall_modelling', wm_json)
call this%bc_wallmodel%init_wall_model_bc(wm_json, this%mu / this%rho)
else
call this%bc_wallmodel%shear_stress_t%init_shear_stress(this%c_Xh)
call this%bc_wallmodel%shear_stress_t%init_shear_stress(this%c_Xh)
end if

call bc_list_add(this%bclst_vel, this%bc_wallmodel%symmetry)
17 changes: 14 additions & 3 deletions src/les/dynamic_smagorinsky.f90
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@ module dynamic_smagorinsky
use coefs, only : coef_t
use elementwise_filter, only : elementwise_filter_t
use dynamic_smagorinsky_cpu, only : dynamic_smagorinsky_compute_cpu
use logger, only : LOG_SIZE, neko_log
use dynamic_smagorinsky_device, only : dynamic_smagorinsky_compute_device
implicit none
private
@@ -55,7 +56,6 @@ module dynamic_smagorinsky
!> Coefficient of the model.
type(field_t) :: c_dyn
!> Test filter.
character(len=:), allocatable :: test_filter_type
type(elementwise_filter_t) :: test_filter
!> Mij
!! index for tensor mij and lij:
@@ -90,17 +90,28 @@ subroutine dynamic_smagorinsky_init(this, dofmap, coef, json)
character(len=:), allocatable :: nut_name !! The name of the SGS viscosity field.
integer :: i
character(len=:), allocatable :: delta_type
character(len=:), allocatable :: test_filter_type
character(len=LOG_SIZE) :: log_buf

call json_get_or_default(json, "nut_field", nut_name, "nut")
call json_get_or_default(json, "delta_type", delta_type, "pointwise")
call json_get_or_default(json, "test_filter_type", test_filter_type, "nonBoyd")

call this%free()
call this%init_base(dofmap, coef, nut_name, delta_type)
this%test_filter_type = "nonBoyd"
! Filter assumes lx = ly = lz
call this%test_filter%init(dofmap%xh%lx, this%test_filter_type)
call this%test_filter%init(dofmap%xh%lx, test_filter_type)
call set_ds_filt(this%test_filter)

call neko_log%section('LES model')
write(log_buf, '(A)') 'Model : Dynamic Smagorinsky'
call neko_log%message(log_buf)
write(log_buf, '(A, A)') 'Delta evaluation : ', delta_type
call neko_log%message(log_buf)
write(log_buf, '(A, A)') 'Test filter type : ', test_filter_type
call neko_log%message(log_buf)
call neko_log%end_section()

call this%c_dyn%init(dofmap, "ds_c_dyn")
call this%num%init(dofmap, "ds_num")
call this%den%init(dofmap, "ds_den")
11 changes: 11 additions & 0 deletions src/les/sigma.f90
Original file line number Diff line number Diff line change
@@ -44,6 +44,7 @@ module sigma
use sigma_cpu, only : sigma_compute_cpu
use sigma_device, only : sigma_compute_device
use coefs, only : coef_t
use logger, only : LOG_SIZE, neko_log
implicit none
private

@@ -76,12 +77,22 @@ subroutine sigma_init(this, dofmap, coef, json)
character(len=:), allocatable :: nut_name
real(kind=rp) :: c
character(len=:), allocatable :: delta_type
character(len=LOG_SIZE) :: log_buf

call json_get_or_default(json, "nut_field", nut_name, "nut")
call json_get_or_default(json, "delta_type", delta_type, "pointwise")
! Based on C = 1.35 as default values
call json_get_or_default(json, "c", c, 1.35_rp)

call neko_log%section('LES model')
write(log_buf, '(A)') 'Model : Sigma'
call neko_log%message(log_buf)
write(log_buf, '(A, A)') 'Delta evaluation : ', delta_type
call neko_log%message(log_buf)
write(log_buf, '(A, E15.7)') 'c : ', c
call neko_log%message(log_buf)
call neko_log%end_section()

call sigma_init_from_components(this, dofmap, coef, c, nut_name, delta_type)
end subroutine sigma_init

11 changes: 11 additions & 0 deletions src/les/smagorinsky.f90
Original file line number Diff line number Diff line change
@@ -44,6 +44,7 @@ module smagorinsky
use smagorinsky_cpu, only : smagorinsky_compute_cpu
use smagorinsky_device, only : smagorinsky_compute_device
use coefs, only : coef_t
use logger, only : LOG_SIZE, neko_log
implicit none
private

@@ -77,11 +78,21 @@ subroutine smagorinsky_init(this, dofmap, coef, json)
character(len=:), allocatable :: nut_name
real(kind=rp) :: c_s
character(len=:), allocatable :: delta_type
character(len=LOG_SIZE) :: log_buf

call json_get_or_default(json, "nut_field", nut_name, "nut")
call json_get_or_default(json, "delta_type", delta_type, "pointwise")
call json_get_or_default(json, "c_s", c_s, 0.17_rp)

call neko_log%section('LES model')
write(log_buf, '(A)') 'Model : Smagorinsky'
call neko_log%message(log_buf)
write(log_buf, '(A, A)') 'Delta evaluation : ', delta_type
call neko_log%message(log_buf)
write(log_buf, '(A, E15.7)') 'c_s : ', c_s
call neko_log%message(log_buf)
call neko_log%end_section()

call smagorinsky_init_from_components(this, dofmap, coef, c_s, nut_name, &
delta_type)
end subroutine smagorinsky_init
11 changes: 11 additions & 0 deletions src/les/vreman.f90
Original file line number Diff line number Diff line change
@@ -44,6 +44,7 @@ module vreman
use vreman_cpu, only : vreman_compute_cpu
use vreman_device, only : vreman_compute_device
use coefs, only : coef_t
use logger, only : LOG_SIZE, neko_log
implicit none
private

@@ -77,12 +78,22 @@ subroutine vreman_init(this, dofmap, coef, json)
character(len=:), allocatable :: nut_name
real(kind=rp) :: c
character(len=:), allocatable :: delta_type
character(len=LOG_SIZE) :: log_buf

call json_get_or_default(json, "nut_field", nut_name, "nut")
call json_get_or_default(json, "delta_type", delta_type, "pointwise")
! Based on the Smagorinsky Cs = 0.17.
call json_get_or_default(json, "c", c, 0.07_rp)

call neko_log%section('LES model')
write(log_buf, '(A)') 'Model : Vreman'
call neko_log%message(log_buf)
write(log_buf, '(A, A)') 'Delta evaluation : ', delta_type
call neko_log%message(log_buf)
write(log_buf, '(A, E15.7)') 'c : ', c
call neko_log%message(log_buf)
call neko_log%end_section()

call vreman_init_from_components(this, dofmap, coef, c, nut_name, &
delta_type)
end subroutine vreman_init
5 changes: 4 additions & 1 deletion src/scalar/scalar_scheme.f90
Original file line number Diff line number Diff line change
@@ -397,6 +397,9 @@ subroutine scalar_scheme_init(this, msh, c_Xh, gs_Xh, params, scheme, user, &
this%nut_field_name = ""
end if

write(log_buf, '(A,L1)') 'LES : ', this%variable_material_properties
call neko_log%message(log_buf)

! Fill lambda field with the physical value
call this%lambda_field%init(this%dm_Xh, "lambda")
if (NEKO_BCKND_DEVICE .eq. 1) then
@@ -477,7 +480,7 @@ subroutine scalar_scheme_init(this, msh, c_Xh, gs_Xh, params, scheme, user, &
call scalar_scheme_precon_factory(this%pc, this%ksp, &
this%c_Xh, this%dm_Xh, this%gs_Xh, &
this%bclst_dirichlet, solver_precon)

! Initiate gradient jump penalty
call json_get_or_default(params, &
'case.scalar.gradient_jump_penalty.enabled',&
9 changes: 9 additions & 0 deletions src/simulation_components/les_simcomp.f90
Original file line number Diff line number Diff line change
@@ -41,6 +41,7 @@ module les_simcomp
use les_model, only : les_model_t, les_model_factory
use json_utils, only : json_get, json_get_or_default
use field_writer, only : field_writer_t
use utils, only : neko_error
implicit none
private

@@ -73,6 +74,14 @@ subroutine les_simcomp_init_from_json(this, json, case)

call this%free()

! Check for whether eddy viscosity is enabled in fluid_scheme
if (case%fluid%variable_material_properties .eqv. .false.) then
call neko_error("Eddy viscosity is not acting &
&on the equations. &
&Please set up a nut_field option &
&in the fluid solver")
end if

! Add fields keyword to the json so that the field_writer picks it up.
! Will also add fields to the registry if missing.
call json_get_or_default(json, "nut_field", nut_field, "nut")

0 comments on commit 70a4942

Please sign in to comment.