Prepares the boundary conditions used by CDIFS. This subroutine reads pre-existing BCS file on disk. The BCS file must include boundary conditions for restart fields (i.e., V1,V2,V3,P) at minimum. Additional boundary conditions may be required. E.g. if IBs are used, the file must contain boundary conditions for ibVF. In such a case, the subroutine adds additional boundary conditions for ibF, ibN, and ibS based on the specified boundary conditions for ibVF. If no Dirichlet conditions are given for ibVF, it marks the volume fraction Poisson equation as singular.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cdifs_obj), | intent(inout) | :: | this |
CDIFS solver |
subroutine cdifs_obj_PrepareSolverBCS(this) !> Prepares the boundary conditions used by CDIFS. ! This subroutine reads pre-existing BCS file on disk. ! The BCS file must include boundary conditions for restart fields ! (i.e., V1,V2,V3,P) at minimum. Additional boundary conditions ! may be required. E.g. if IBs are used, the file must contain ! boundary conditions for ibVF. In such a case, the subroutine adds ! additional boundary conditions for ibF, ibN, and ibS based on the ! specified boundary conditions for ibVF. If no Dirichlet conditions ! are given for ibVF, it marks the volume fraction Poisson equation as ! singular. implicit none class(cdifs_obj), intent(inout) :: this !! CDIFS solver ! Work variables real(wp) :: time integer :: iter integer :: n real(wp), pointer :: BCVal(:,:,:) character(len=str64):: filename logical :: ibVFDirichlet logical :: buffL call this%parser%Get("BC file", filename, default = 'bcs' ) ! Initialize and read boundary conditions call this%bcs%Initialize(this%block,this%parallel) call this%bcs%Read(iter,time,filename) ! Create masks call this%bcs%BuildMask('V1',this%maskV(1)) call this%bcs%BuildMask('V2',this%maskV(2)) call this%bcs%BuildMask('V3',this%maskV(3)) ! Update boundary conditions for U,V,W,P call this%bcs%UpdateBoundary(this%V) call this%bcs%UpdateBoundary(this%P) associate (bcs => this%bcs) if (this%use_RP .or. this%use_IB) then ! Check boundary conditions for ibVF ibVFDirichlet = .false. do n=1,bcs%count ! Check Whether we have a BC for this variable on this region if (.not.bcs%CheckBCExists(bcs%region(n)%name,'ibVF')) cycle select case (bcs%GetBCType(bcs%region(n)%name,'ibVF')) case (BC_DIRICHLET) ! Found Dirichlet condition ibVFDirichlet = .true. call bcs%SetBC(bcs%region(n)%name,BC_DIRICHLET,'ibS' ) call bcs%SetBC(bcs%region(n)%name,BC_DIRICHLET,'ibN1') call bcs%SetBC(bcs%region(n)%name,BC_DIRICHLET,'ibN2') call bcs%SetBC(bcs%region(n)%name,BC_DIRICHLET,'ibN3') call bcs%SetBC(bcs%region(n)%name,BC_DIRICHLET,'ibF1') call bcs%SetBC(bcs%region(n)%name,BC_DIRICHLET,'ibF2') call bcs%SetBC(bcs%region(n)%name,BC_DIRICHLET,'ibF3') call bcs%GetBCPointer(bcs%region(n)%name,'ibS', BCVal); BCVal = 0.0_wp call bcs%GetBCPointer(bcs%region(n)%name,'ibN1', BCVal); BCVal = 0.0_wp call bcs%GetBCPointer(bcs%region(n)%name,'ibN2', BCVal); BCVal = 0.0_wp call bcs%GetBCPointer(bcs%region(n)%name,'ibN3', BCVal); BCVal = 0.0_wp call bcs%GetBCPointer(bcs%region(n)%name,'ibF1', BCVal); BCVal = 0.0_wp call bcs%GetBCPointer(bcs%region(n)%name,'ibF2', BCVal); BCVal = 0.0_wp call bcs%GetBCPointer(bcs%region(n)%name,'ibF3', BCVal); BCVal = 0.0_wp case (BC_NEUMANN) case (BC_SYMMETRY) call bcs%SetBC(bcs%region(n)%name,BC_SYMMETRY,'ibS' ) call bcs%SetBC(bcs%region(n)%name,BC_SYMMETRY,'ibN1') call bcs%SetBC(bcs%region(n)%name,BC_SYMMETRY,'ibN2') call bcs%SetBC(bcs%region(n)%name,BC_SYMMETRY,'ibN3') call bcs%SetBC(bcs%region(n)%name,BC_SYMMETRY,'ibF1') call bcs%SetBC(bcs%region(n)%name,BC_SYMMETRY,'ibF2') call bcs%SetBC(bcs%region(n)%name,BC_SYMMETRY,'ibF3') end select end do call this%parallel%Lor(ibVFDirichlet,buffL); ibVFDirichlet=buffL ! Determine if we need to apply volume fraction corrections if (.not.ibVFDirichlet) this%singularVF = .true. end if end associate return end subroutine cdifs_obj_PrepareSolverBCS