132 type(
case_t),
target,
intent(inout) :: this
134 logical :: scalar = .false.
135 type(
file_t) :: msh_file, bdry_file, part_file
137 logical :: found, logical_val
138 integer :: integer_val
139 real(kind=
rp) :: real_val
140 character(len = :),
allocatable :: string_val
141 real(kind=
rp) :: stats_start_time, stats_output_val
142 integer :: stats_sampling_interval
143 integer :: output_dir_len
151 if (trim(string_val) .eq.
'no mesh')
then
152 call neko_error(
'The mesh_file keyword could not be found in the .' // &
153 'case file. Often caused by incorrectly formatted json.')
155 msh_file =
file_t(string_val)
157 call msh_file%read(this%msh)
165 if (
pe_size .gt. 1 .and. logical_val)
then
166 call neko_log%section(
'Load Balancing')
175 call this%params%get(
'case.variable_timestep', logical_val, found)
176 if (.not. logical_val)
then
177 call json_get(this%params,
'case.timestep', this%dt)
186 call json_get(this%params,
'case.end_time', this%end_time)
197 call this%usr%user_mesh_setup(this%msh)
202 call json_get(this%params,
'case.numerics.time_order', integer_val)
203 call this%ext_bdf%init(integer_val)
208 call json_get(this%params,
'case.fluid.scheme', string_val)
209 call fluid_scheme_factory(this%fluid, trim(string_val))
211 call json_get(this%params,
'case.numerics.polynomial_order', lx)
213 this%fluid%chkp%tlag => this%tlag
214 this%fluid%chkp%dtlag => this%dtlag
215 call this%fluid%init(this%msh, lx, this%params, this%usr, this%ext_bdf)
216 select type (f => this%fluid)
218 f%chkp%abx1 => f%abx1
219 f%chkp%abx2 => f%abx2
220 f%chkp%aby1 => f%aby1
221 f%chkp%aby2 => f%aby2
222 f%chkp%abz1 => f%abz1
223 f%chkp%abz2 => f%abz2
236 if (this%params%valid_path(
'case.scalar'))
then
242 allocate(this%scalar)
243 this%scalar%chkp%tlag => this%tlag
244 this%scalar%chkp%dtlag => this%dtlag
245 call this%scalar%init(this%msh, this%fluid%c_Xh, this%fluid%gs_Xh, &
246 this%params, this%usr, this%fluid%ulag, this%fluid%vlag, &
247 this%fluid%wlag, this%ext_bdf, this%fluid%rho)
249 call this%fluid%chkp%add_scalar(this%scalar%s)
251 this%fluid%chkp%abs1 => this%scalar%abx1
252 this%fluid%chkp%abs2 => this%scalar%abx2
253 this%fluid%chkp%slag => this%scalar%slag
259 if (this%params%valid_path(
'case.fluid.inflow_condition'))
then
260 call json_get(this%params,
'case.fluid.inflow_condition.type',&
262 if (trim(string_val) .eq.
'user')
then
263 call this%fluid%set_usr_inflow(this%usr%fluid_user_if)
269 call this%scalar%set_user_bc(this%usr%scalar_user_bc)
275 call json_get(this%params,
'case.fluid.initial_condition.type',&
279 call neko_log%section(
"Fluid initial condition ")
281 if (trim(string_val) .ne.
'user')
then
282 call set_flow_ic(this%fluid%u, this%fluid%v, this%fluid%w, &
283 this%fluid%p, this%fluid%c_Xh, this%fluid%gs_Xh, string_val, &
287 call set_flow_ic(this%fluid%u, this%fluid%v, this%fluid%w, this%fluid%p,&
288 this%fluid%c_Xh, this%fluid%gs_Xh, this%usr%fluid_user_ic, &
296 call json_get(this%params,
'case.scalar.initial_condition.type', &
299 call neko_log%section(
"Scalar initial condition ")
301 if (trim(string_val) .ne.
'user')
then
303 this%scalar%c_Xh, this%scalar%gs_Xh, string_val, this%params)
306 this%scalar%c_Xh, this%scalar%gs_Xh, this%usr%scalar_user_ic, &
315 select type (f => this%fluid)
325 call this%fluid%validate
328 call this%scalar%slag%set(this%scalar%s)
329 call this%scalar%validate
336 this%output_directory,
'')
338 output_dir_len = len(trim(this%output_directory))
339 if (output_dir_len .gt. 0)
then
340 if (this%output_directory(output_dir_len:output_dir_len) .ne.
"/")
then
341 this%output_directory = trim(this%output_directory)//
"/"
343 call execute_command_line(
'mkdir -p '//this%output_directory)
352 logical_val, .false.)
353 if (logical_val)
then
354 bdry_file =
file_t(trim(this%output_directory)//
'bdry.fld')
355 call bdry_file%write(this%fluid%bdry)
362 logical_val, .false.)
363 if (logical_val)
then
366 part_file =
file_t(trim(this%output_directory)//
'partitions.vtk')
367 call part_file%write(msh_part)
377 if (trim(string_val) .eq.
'double')
then
386 call this%output_controller%init(this%end_time)
389 path = trim(this%output_directory))
392 path = trim(this%output_directory))
398 if (trim(string_val) .eq.
'org')
then
400 call json_get(this%params,
'case.nsamples', real_val)
401 call this%output_controller%add(this%f_out, real_val,
'nsamples')
402 else if (trim(string_val) .eq.
'never')
then
406 call this%output_controller%add(this%f_out, 0.0_rp, string_val)
408 call json_get(this%params,
'case.fluid.output_value', real_val)
409 call this%output_controller%add(this%f_out, real_val, string_val)
417 if (logical_val)
then
421 path = this%output_directory, fmt = trim(string_val))
423 string_val,
"simulationtime")
426 call this%output_controller%add(this%f_chkp, real_val, string_val)
432 if (this%params%valid_path(
'case.job_timelimit'))
then
433 call json_get(this%params,
'case.job_timelimit', string_val)