143    type(
case_t), 
target, 
intent(inout) :: this
 
  145    logical :: scalar = .false.
 
  146    type(
file_t) :: msh_file, bdry_file, part_file
 
  148    logical :: found, logical_val
 
  149    logical :: temperature_found = .false.
 
  150    integer :: integer_val
 
  151    real(kind=
rp) :: real_val
 
  152    character(len = :), 
allocatable :: string_val, name, file_format
 
  153    integer :: output_dir_len
 
  154    integer :: precision, layout
 
  155    type(json_file) :: scalar_params, numerics_params
 
  156    type(json_file) :: json_subdict
 
  157    integer :: n_scalars, i
 
  162    call this%user%init()
 
  165    call this%user%startup(this%params)
 
  168    if (this%params%valid_path(
'case.no_defaults')) 
then 
  177    if (trim(string_val) .eq. 
'no mesh') 
then 
  178       call neko_error(
'The mesh_file keyword could not be found in the .' // &
 
  179            'case file. Often caused by incorrectly formatted json.')
 
  181    call msh_file%init(string_val)
 
  183    call msh_file%read(this%msh)
 
  191    if (
pe_size .gt. 1 .and. logical_val) 
then 
  192       call neko_log%section(
'Load Balancing')
 
  197       string_val = trim(string_val(1:scan(trim(string_val), &
 
  198            '.', back = .true.) - 1)) // 
'_lb.nmsh' 
  199       call msh_file%init(string_val)
 
  200       call msh_file%write(this%msh)
 
  208    call json_get(this%params, 
'case.time', json_subdict)
 
  209    call this%time%init(json_subdict)
 
  217    call this%user%mesh_setup(this%msh, this%time)
 
  219    call json_get(this%params, 
'case.numerics', numerics_params)
 
  224    call json_get(this%params, 
'case.fluid.scheme', string_val)
 
  225    call fluid_scheme_base_factory(this%fluid, trim(string_val))
 
  227    call json_get(this%params, 
'case.numerics.polynomial_order', lx)
 
  230    this%chkp%tlag => this%time%tlag
 
  231    this%chkp%dtlag => this%time%dtlag
 
  232    call this%fluid%init(this%msh, lx, this%params, this%user, this%chkp)
 
  246    if (this%params%valid_path(
'case.scalar')) 
then 
  250    else if (this%params%valid_path(
'case.scalars')) 
then 
  251       call this%params%info(
'case.scalars', n_children = n_scalars)
 
  252       if (n_scalars > 0) 
then 
  258       allocate(this%scalars)
 
  259       if (this%params%valid_path(
'case.scalar')) 
then 
  261          call json_get(this%params, 
'case.scalar', scalar_params)
 
  262          call this%scalars%init(this%msh, this%fluid%c_Xh, this%fluid%gs_Xh, &
 
  263               scalar_params, numerics_params, this%user, this%chkp, this%fluid%ulag, &
 
  264               this%fluid%vlag, this%fluid%wlag, this%fluid%ext_bdf, &
 
  268          call json_get(this%params, 
'case.scalars', json_subdict)
 
  269          call this%scalars%init(n_scalars, this%msh, this%fluid%c_Xh, this%fluid%gs_Xh, &
 
  270               json_subdict, numerics_params, this%user, this%chkp, this%fluid%ulag, &
 
  271               this%fluid%vlag, this%fluid%wlag, this%fluid%ext_bdf, &
 
  279    call json_get(this%params, 
'case.fluid.initial_condition.type', &
 
  281    call json_get(this%params, 
'case.fluid.initial_condition', &
 
  284    call neko_log%section(
"Fluid initial condition ")
 
  286    if (this%params%valid_path(
'case.restart_file')) 
then 
  287       call neko_log%message(
"Restart file specified, " // &
 
  288            "initial conditions ignored")
 
  289    else if (trim(string_val) .ne. 
'user') 
then 
  290       call set_flow_ic(this%fluid%u, this%fluid%v, this%fluid%w, &
 
  291            this%fluid%p, this%fluid%c_Xh, this%fluid%gs_Xh, string_val, &
 
  294       call json_get(this%params, 
'case.fluid.scheme', string_val)
 
  295       if (trim(string_val) .eq. 
'compressible') 
then 
  297               this%fluid%u, this%fluid%v, this%fluid%w, this%fluid%p, &
 
  298               this%fluid%c_Xh, this%fluid%gs_Xh, &
 
  299               this%user%initial_conditions, this%fluid%name)
 
  301          call set_flow_ic(this%fluid%u, this%fluid%v, this%fluid%w, &
 
  302               this%fluid%p, this%fluid%c_Xh, this%fluid%gs_Xh, &
 
  303               this%user%initial_conditions, this%fluid%name)
 
  310       call neko_log%section(
"Scalar initial condition ")
 
  312       if (this%params%valid_path(
'case.restart_file')) 
then 
  313          call neko_log%message(
"Restart file specified, " // &
 
  314               "initial conditions ignored")
 
  315       else if (this%params%valid_path(
'case.scalar')) 
then 
  317          call json_get(this%params, 
'case.scalar.initial_condition.type', &
 
  320               'case.scalar.initial_condition', json_subdict)
 
  322          if (trim(string_val) .ne. 
'user') 
then 
  323             if (trim(this%scalars%scalar_fields(1)%name) .eq. 
'temperature') 
then 
  325                     this%scalars%scalar_fields(1)%c_Xh, &
 
  326                     this%scalars%scalar_fields(1)%gs_Xh, &
 
  327                     string_val, json_subdict, 0)
 
  330                     this%scalars%scalar_fields(1)%c_Xh, &
 
  331                     this%scalars%scalar_fields(1)%gs_Xh, &
 
  332                     string_val, json_subdict, 1)
 
  336                  this%scalars%scalar_fields(1)%s, &
 
  337                  this%scalars%scalar_fields(1)%c_Xh, &
 
  338                  this%scalars%scalar_fields(1)%gs_Xh, &
 
  339                  this%user%initial_conditions)
 
  347             call json_get(scalar_params, 
'initial_condition.type', string_val)
 
  348             call json_get(scalar_params, 
'initial_condition', &
 
  351             if (trim(string_val) .ne. 
'user') 
then 
  352                if (trim(this%scalars%scalar_fields(i)%name) .eq. 
'temperature') 
then 
  354                        this%scalars%scalar_fields(i)%c_Xh, &
 
  355                        this%scalars%scalar_fields(i)%gs_Xh, &
 
  356                        string_val, json_subdict, 0)
 
  357                   temperature_found = .true.
 
  359                   if (temperature_found) 
then 
  362                           this%scalars%scalar_fields(i)%c_Xh, &
 
  363                           this%scalars%scalar_fields(i)%gs_Xh, &
 
  364                           string_val, json_subdict, i - 1)
 
  368                           this%scalars%scalar_fields(i)%c_Xh, &
 
  369                           this%scalars%scalar_fields(i)%gs_Xh, &
 
  370                           string_val, json_subdict, i)
 
  375                     this%scalars%scalar_fields(i)%s, &
 
  376                     this%scalars%scalar_fields(i)%c_Xh, &
 
  377                     this%scalars%scalar_fields(i)%gs_Xh, &
 
  378                     this%user%initial_conditions)
 
  387    select type (f => this%fluid)
 
  397    call this%fluid%validate
 
  400       call this%scalars%validate()
 
  407         this%output_directory, 
'')
 
  409    output_dir_len = len(trim(this%output_directory))
 
  410    if (output_dir_len .gt. 0) 
then 
  411       if (this%output_directory(output_dir_len:output_dir_len) .ne. 
"/") 
then 
  412          this%output_directory = trim(this%output_directory)//
"/" 
  414             call execute_command_line(
'mkdir -p '//this%output_directory)
 
  423         logical_val, .false.)
 
  424    if (logical_val) 
then 
  425       call msh_part%init(this%msh, 
'MPI_Rank')
 
  427       call part_file%init(trim(this%output_directory)//
'partitions.vtk')
 
  428       call part_file%write(msh_part)
 
  438    if (trim(string_val) .eq. 
'double') 
then 
  456    call this%output_controller%init(this%time%end_time)
 
  458       call this%f_out%init(precision, this%fluid, this%scalars, name = name, &
 
  459            path = trim(this%output_directory), &
 
  460            fmt = trim(file_format), layout = layout)
 
  462       call this%f_out%init(precision, this%fluid, name = name, &
 
  463            path = trim(this%output_directory), &
 
  464            fmt = trim(file_format), layout = layout)
 
  470    if (trim(string_val) .eq. 
'org') 
then 
  472       call json_get(this%params, 
'case.nsamples', real_val)
 
  473       call this%output_controller%add(this%f_out, real_val, 
'nsamples')
 
  474    else if (trim(string_val) .eq. 
'never') 
then 
  478       call this%output_controller%add(this%f_out, 0.0_rp, string_val)
 
  480       call json_get(this%params, 
'case.fluid.output_value', real_val)
 
  481       call this%output_controller%add(this%f_out, real_val, string_val)
 
  489    if (logical_val) 
then 
  494       call this%chkp_out%init(this%chkp, name = name,&
 
  495            path = this%output_directory, fmt = trim(string_val))
 
  497            string_val, 
"simulationtime")
 
  500       call this%output_controller%add(this%chkp_out, real_val, string_val, &
 
  507    if (this%params%valid_path(
'case.job_timelimit')) 
then 
  508       call json_get(this%params, 
'case.job_timelimit', string_val)