build_bc_set Subroutine

public subroutine build_bc_set(mesh, params, bc)

Synchronizes namelist parameters with mesh patches to create a complete BC set.

This routine iterates through all patches in the mesh_t structure and searches for matching names in the case_params_t object. It converts string-based inputs into internal type IDs.

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh

The computational mesh containing patch definitions.

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

Parsed case configuration from case.nml.

type(bc_set_t), intent(inout) :: bc

The boundary condition set to be populated.


Calls

proc~~build_bc_set~~CallsGraph proc~build_bc_set mod_bc::build_bc_set proc~ensure_periodic_links mod_bc::ensure_periodic_links proc~build_bc_set->proc~ensure_periodic_links proc~fatal_error mod_kinds::fatal_error proc~build_bc_set->proc~fatal_error proc~finalize_bc_set mod_bc::finalize_bc_set proc~build_bc_set->proc~finalize_bc_set proc~lowercase mod_kinds::lowercase proc~build_bc_set->proc~lowercase proc~parse_bc_type mod_bc::parse_bc_type proc~build_bc_set->proc~parse_bc_type proc~ensure_periodic_links->proc~fatal_error proc~parse_bc_type->proc~fatal_error proc~parse_bc_type->proc~lowercase

Called by

proc~~build_bc_set~~CalledByGraph proc~build_bc_set mod_bc::build_bc_set program~lowmach_react_hex lowmach_react_hex program~lowmach_react_hex->proc~build_bc_set

Source Code

   subroutine build_bc_set(mesh, params, bc)
      type(mesh_t), intent(in) :: mesh
      type(case_params_t), intent(in) :: params
      type(bc_set_t), intent(inout) :: bc

      integer :: p, q
      logical :: found

      call finalize_bc_set(bc)
      bc%npatches = mesh%npatches
      allocate(bc%patches(mesh%npatches))

      do p = 1, mesh%npatches
         bc%patches(p)%patch_id = p
         bc%patches(p)%name = mesh%patches(p)%name
         bc%patches(p)%type_name = "wall"
         bc%patches(p)%type_id = bc_wall
         found = .false.

         do q = 1, params%n_patches
            if (trim(params%patch_name(q)) == trim(mesh%patches(p)%name)) then
               bc%patches(p)%type_name = trim(lowercase(params%patch_type(q)))
               bc%patches(p)%type_id = parse_bc_type(params%patch_type(q))
               bc%patches(p)%velocity = [params%patch_u(q), params%patch_v(q), params%patch_w(q)]
               bc%patches(p)%pressure = params%patch_p(q)
               bc%patches(p)%dpdn = params%patch_dpdn(q)
               bc%patches(p)%temperature = params%patch_T(q)

               if (trim(params%patch_velocity_type(q)) /= "") then
                  bc%patches(p)%velocity_type_id = parse_bc_type(params%patch_velocity_type(q))
               else
                  bc%patches(p)%velocity_type_id = parse_bc_type(params%patch_type(q))
               end if

               if (trim(params%patch_pressure_type(q)) /= "") then
                  bc%patches(p)%pressure_type_id = parse_bc_type(params%patch_pressure_type(q))
               else
                  bc%patches(p)%pressure_type_id = parse_bc_type(params%patch_type(q))
               end if

               if (trim(params%patch_species_type(q)) /= "") then
                  bc%patches(p)%species_type_id = parse_bc_type(params%patch_species_type(q))
               else
                  bc%patches(p)%species_type_id = parse_bc_type(params%patch_type(q))
               end if
               bc%patches(p)%species_Y(:) = params%patch_Y(:, q)

               if (trim(params%patch_temperature_type(q)) /= "") then
                  bc%patches(p)%temperature_type_id = parse_bc_type(params%patch_temperature_type(q))
               else
                  bc%patches(p)%temperature_type_id = parse_bc_type(params%patch_type(q))
               end if

               found = .true.
               exit
            end if
         end do

         if (.not. found) then
            call fatal_error('bc', 'mesh patch '//trim(mesh%patches(p)%name)//' missing from case.nml')
         end if

         if (bc%patches(p)%type_id == bc_periodic) then
            call ensure_periodic_links(mesh, p)
         end if
      end do
   end subroutine build_bc_set