138 type(
case_t),
target,
intent(inout) :: this
140 logical :: scalar = .false.
141 type(
file_t) :: msh_file, bdry_file, part_file
143 logical :: found, logical_val
144 integer :: integer_val
145 real(kind=
rp) :: real_val
146 character(len = :),
allocatable :: string_val, name
147 integer :: output_dir_len
149 type(json_file) :: scalar_params, numerics_params
150 type(json_file) :: json_subdict
158 call this%usr%user_startup(this%params)
165 if (trim(string_val) .eq.
'no mesh')
then
166 call neko_error(
'The mesh_file keyword could not be found in the .' // &
167 'case file. Often caused by incorrectly formatted json.')
169 msh_file =
file_t(string_val)
171 call msh_file%read(this%msh)
179 if (
pe_size .gt. 1 .and. logical_val)
then
180 call neko_log%section(
'Load Balancing')
185 string_val = trim(string_val(1:scan(trim(string_val), &
186 '.', back = .true.) - 1)) //
'_lb.nmsh'
187 msh_file =
file_t(string_val)
188 call msh_file%write(this%msh)
197 logical_val, .false.)
198 if (.not. logical_val)
then
199 call json_get(this%params,
'case.timestep', this%time%dt)
202 this%time%dt = 1.0_rp
208 call json_get(this%params,
'case.end_time', this%time%end_time)
216 call this%usr%user_mesh_setup(this%msh)
223 call json_get(this%params,
'case.fluid.scheme', string_val)
224 call fluid_scheme_base_factory(this%fluid, trim(string_val))
226 call json_get(this%params,
'case.numerics.polynomial_order', lx)
229 this%chkp%tlag => this%time%tlag
230 this%chkp%dtlag => this%time%dtlag
231 call this%fluid%init(this%msh, lx, this%params, this%usr, this%chkp)
243 if (this%params%valid_path(
'case.scalar'))
then
249 allocate(this%scalar)
251 call this%scalar%init(this%msh, this%fluid%c_Xh, this%fluid%gs_Xh, &
252 scalar_params, numerics_params, this%usr, this%chkp, this%fluid%ulag, &
253 this%fluid%vlag, this%fluid%wlag, this%fluid%ext_bdf, &
261 call json_get(this%params,
'case.fluid.initial_condition.type', &
266 call neko_log%section(
"Fluid initial condition ")
268 if (trim(string_val) .ne.
'user')
then
269 call set_flow_ic(this%fluid%u, this%fluid%v, this%fluid%w, &
270 this%fluid%p, this%fluid%c_Xh, this%fluid%gs_Xh, string_val, &
273 call json_get(this%params,
'case.fluid.scheme', string_val)
274 if (trim(string_val) .eq.
'compressible')
then
276 this%fluid%u, this%fluid%v, this%fluid%w, this%fluid%p, &
277 this%fluid%c_Xh, this%fluid%gs_Xh, this%usr%fluid_compressible_user_ic, &
280 call set_flow_ic(this%fluid%u, this%fluid%v, this%fluid%w, this%fluid%p,&
281 this%fluid%c_Xh, this%fluid%gs_Xh, this%usr%fluid_user_ic, &
290 call json_get(this%params,
'case.scalar.initial_condition.type', &
295 call neko_log%section(
"Scalar initial condition ")
297 if (trim(string_val) .ne.
'user')
then
299 this%scalar%c_Xh, this%scalar%gs_Xh, string_val, json_subdict)
302 this%scalar%c_Xh, this%scalar%gs_Xh, this%usr%scalar_user_ic, &
311 select type (f => this%fluid)
321 call this%fluid%validate
324 call this%scalar%slag%set(this%scalar%s)
325 call this%scalar%validate
332 this%output_directory,
'')
334 output_dir_len = len(trim(this%output_directory))
335 if (output_dir_len .gt. 0)
then
336 if (this%output_directory(output_dir_len:output_dir_len) .ne.
"/")
then
337 this%output_directory = trim(this%output_directory)//
"/"
339 call execute_command_line(
'mkdir -p '//this%output_directory)
348 logical_val, .false.)
349 if (logical_val)
then
352 part_file =
file_t(trim(this%output_directory)//
'partitions.vtk')
353 call part_file%write(msh_part)
363 if (trim(string_val) .eq.
'double')
then
372 call this%output_controller%init(this%time%end_time)
376 call this%f_out%init(precision, this%fluid, this%scalar, name = name, &
377 path = trim(this%output_directory))
379 call this%f_out%init(precision, this%fluid, name = name, &
380 path = trim(this%output_directory))
386 if (trim(string_val) .eq.
'org')
then
388 call json_get(this%params,
'case.nsamples', real_val)
389 call this%output_controller%add(this%f_out, real_val,
'nsamples')
390 else if (trim(string_val) .eq.
'never')
then
394 call this%output_controller%add(this%f_out, 0.0_rp, string_val)
396 call json_get(this%params,
'case.fluid.output_value', real_val)
397 call this%output_controller%add(this%f_out, real_val, string_val)
405 if (logical_val)
then
411 path = this%output_directory, fmt = trim(string_val))
413 string_val,
"simulationtime")
416 call this%output_controller%add(this%chkp_out, real_val, string_val, &
423 if (this%params%valid_path(
'case.job_timelimit'))
then
424 call json_get(this%params,
'case.job_timelimit', string_val)