85 type(json_file),
intent(inout) :: json
86 type(json_file) :: json_subdict
87 character(len=:),
allocatable :: nut_name
89 character(len=:),
allocatable :: delta_type
91 character(len=:),
allocatable :: filter_type
92 character(len=LOG_SIZE) :: log_buf
94 associate(
dofmap => fluid%dm_Xh, &
102 call this%init_base(fluid, nut_name, delta_type, if_ext)
103 call json_get(json,
"test_filter", json_subdict)
104 call this%test_filter%init(json_subdict, coef)
105 if (json%valid_path(
'filter.transfer_function'))
then
106 call neko_error(
"Dynamic Smagorinsky model does not support " // &
107 "transfer function specified in the json file. " // &
108 "Please hard-code it in " // &
109 "subroutine set_ds_filt() in " // &
110 "src/les/dynamic_smagorisnky.f90")
112 if (json%valid_path(
'filter.type'))
then
113 call json_get(json,
"filter.type", filter_type)
114 if (trim(filter_type) .ne.
"elementwise")
then
115 call neko_error(
"Currently only elementwise filter is supported &
116 &for dynamic smagorinsky model.")
123 write(log_buf,
'(A)')
'Model : Dynamic Smagorinsky'
125 write(log_buf,
'(A, A)')
'Delta evaluation : ', delta_type
127 write(log_buf,
'(A, A)')
'Test filter type : ', &
128 this%test_filter%filter_type
130 write(log_buf,
'(A, L1)')
'extrapolation : ', if_ext
134 call this%c_dyn%init(
dofmap,
"ds_c_dyn")
135 call this%num%init(
dofmap,
"ds_num")
136 call this%den%init(
dofmap,
"ds_den")
139 call this%mij(i)%init(
dofmap)
140 call this%lij(i)%init(
dofmap)
169 real(kind=rp),
intent(in) :: t
170 integer,
intent(in) :: tstep
172 type(field_t),
pointer :: u, v, w, u_e, v_e, w_e
174 if (this%if_ext .eqv. .true.)
then
176 associate(ulag => this%ulag, vlag => this%vlag, &
177 wlag => this%wlag, ext_bdf => this%ext_bdf)
179 u => neko_field_registry%get_field_by_name(
"u")
180 v => neko_field_registry%get_field_by_name(
"v")
181 w => neko_field_registry%get_field_by_name(
"w")
182 u_e => neko_field_registry%get_field_by_name(
"u_e")
183 v_e => neko_field_registry%get_field_by_name(
"v_e")
184 w_e => neko_field_registry%get_field_by_name(
"w_e")
186 call this%sumab%compute_fluid(u_e, v_e, w_e, u, v, w, &
187 ulag, vlag, wlag, ext_bdf%advection_coeffs, ext_bdf%nadv)
193 if (neko_bcknd_device .eq. 1)
then
194 call dynamic_smagorinsky_compute_device(this%if_ext, t, tstep, &
195 this%coef, this%nut, &
196 this%delta, this%c_dyn, this%test_filter, &
197 this%mij, this%lij, this%num, this%den)
199 call dynamic_smagorinsky_compute_cpu(this%if_ext, t, tstep, &
200 this%coef, this%nut, &
201 this%delta, this%c_dyn, this%test_filter, &
202 this%mij, this%lij, this%num, this%den)
209 type(elementwise_filter_t),
intent(inout) :: filter_1d
212 if (filter_1d%nx .le. 2)
then
213 call neko_error(
"Dynamic Smagorinsky model error: test filter is not &
214 &defined for the current polynomial order")
216 if (mod(filter_1d%nx,2) .eq. 0)
then
218 filter_1d%transfer(int((filter_1d%nx)/2)) = 0.95_rp
219 filter_1d%transfer(int((filter_1d%nx)/2) + 1) = 0.50_rp
220 filter_1d%transfer(int((filter_1d%nx)/2) + 2) = 0.05_rp
221 if ((int((filter_1d%nx)/2) + 2) .lt. filter_1d%nx)
then
222 do i = int((filter_1d%nx)/2) + 3, filter_1d%nx
223 filter_1d%transfer(i) = 0.0_rp
227 filter_1d%nt = int(filter_1d%nx/2) + 1
230 filter_1d%transfer(int((filter_1d%nx-1)/2)) = 0.95_rp
231 filter_1d%transfer(int((filter_1d%nx-1)/2) + 1) = 0.50_rp
232 filter_1d%transfer(int((filter_1d%nx-1)/2) + 2) = 0.05_rp
233 if ((int((filter_1d%nx-1)/2) + 2) .lt. filter_1d%nx)
then
234 do i = int((filter_1d%nx-1)/2) + 3, filter_1d%nx
235 filter_1d%transfer(i) = 0.0_rp
239 filter_1d%nt = int((filter_1d%nx-1)/2) + 1
242 call filter_1d%build_1d()
subroutine, public dynamic_smagorinsky_compute_cpu(if_ext, t, tstep, coef, nut, delta, c_dyn, test_filter, mij, lij, num, den)
Compute eddy viscosity on the CPU.
subroutine, public dynamic_smagorinsky_compute_device(if_ext, t, tstep, coef, nut, delta, c_dyn, test_filter, mij, lij, num, den)
Compute eddy viscosity on the device.