read_case_params Subroutine

public subroutine read_case_params(filename, params)

Orchestrates the reading of all namelist blocks from the configuration file.

Performs a sequential read of all expected namelist groups and triggers a final validation pass to ensure physical consistency.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename

Path to the .nml file (usually case.nml).

type(case_params_t), intent(inout) :: params

Container to be populated with parsed values.


Source Code

   subroutine read_case_params(filename, params)
      character(len=*), intent(in) :: filename
      type(case_params_t), intent(inout) :: params

      call read_mesh_input(filename, params)
      call read_time_input(filename, params)
      call read_fluid_input(filename, params)
      call read_solver_input(filename, params)
      call read_boundary_input(filename, params)
      call read_species_input(filename, params)
      call read_chemistry_input(filename, params)
      call read_energy_input(filename, params)
      call read_ignition_input(filename, params)
      call read_radiation_input(filename, params)
      call read_output_input(filename, params)
      call read_restart_input(filename, params)
      call read_profiling_input(filename, params)
      call validate_params(params)

      ! Density semantics:
      ! constant-density mode keeps transport%rho=params%rho and treats
      ! energy%rho_thermo as a diagnostic; variable-density density_eos="cantera"
      ! requires Cantera thermo and syncs transport%rho from energy%rho_thermo.
      ! The selected YAML phase defines the actual EOS.  "ideal_gas" is parsed
      ! only to reserve the name and is rejected for active variable-density use.
      params%density_eos = trim(lowercase(params%density_eos))
      if (len_trim(params%density_eos) == 0) params%density_eos = "constant"

      select case (trim(params%density_eos))
      case ("constant", "cantera", "ideal_gas")
         continue
      case default
         call fatal_error("input", "density_eos must be one of: constant, cantera, ideal_gas")
      end select

      if (params%enable_variable_density) then
         select case (trim(params%density_eos))
         case ("cantera")
            if (.not. params%enable_energy) then
               call fatal_error("input", "enable_variable_density with density_eos=cantera requires enable_energy=.true.")
            end if
            if (.not. params%enable_cantera_thermo) then
               call fatal_error("input", "enable_variable_density with density_eos=cantera requires enable_cantera_thermo=.true.")
            end if
            if (params%thermo_update_interval /= 1) then
               call fatal_error("input", "enable_variable_density requires thermo_update_interval=1")
            end if
         case ("ideal_gas")
            call fatal_error("input", "density_eos=ideal_gas is parsed but not implemented for variable-density mode yet")
         case default
            call fatal_error("input", "enable_variable_density currently requires density_eos=cantera")
         end select
      end if

   end subroutine read_case_params