cdifs_obj_ComputeSolidVF Subroutine

private subroutine cdifs_obj_ComputeSolidVF(this)

Computes the solid volume fraction (ibVF) by solving a Poisson equation. This subroutine computes the IB normals fields, applies approriate boundary conditions, and takes the divergence, which forms the right-hand side of the poisson equation. It then uses a HYPRE solver to solve this equation. In case where the Poisson operator is singular and using resolved particles, this subroutine will apply a correction that sets the solid volume fraction at particle centroids.

Type Bound

cdifs_obj

Arguments

Type IntentOptional Attributes Name
class(cdifs_obj), intent(inout) :: this

CDIFS solver


Calls

proc~~cdifs_obj_computesolidvf~~CallsGraph proc~cdifs_obj_computesolidvf cdifs_obj%cdifs_obj_ComputeSolidVF none~updateboundary bc_set%UpdateBoundary proc~cdifs_obj_computesolidvf->none~updateboundary proc~hypre_obj_setrhs hypre_obj%hypre_obj_SetRHS proc~cdifs_obj_computesolidvf->proc~hypre_obj_setrhs proc~hypre_obj_solve hypre_obj%hypre_obj_Solve proc~cdifs_obj_computesolidvf->proc~hypre_obj_solve proc~op_obj_applylaplaciandc op_obj%op_obj_ApplyLaplacianDC proc~cdifs_obj_computesolidvf->proc~op_obj_applylaplaciandc proc~respart_set_getcentroidvf ResPart_set%ResPart_set_GetCentroidVF proc~cdifs_obj_computesolidvf->proc~respart_set_getcentroidvf proc~respart_set_updatenormals ResPart_set%ResPart_set_UpdateNormals proc~cdifs_obj_computesolidvf->proc~respart_set_updatenormals proc~bc_set_updateboundaryscalar bc_set%bc_set_UpdateBoundaryScalar none~updateboundary->proc~bc_set_updateboundaryscalar proc~bc_set_updateboundaryvector bc_set%bc_set_UpdateBoundaryVector none~updateboundary->proc~bc_set_updateboundaryvector proc~hypre_obj_setrhsij hypre_obj%hypre_obj_SetRHSIJ proc~hypre_obj_setrhs->proc~hypre_obj_setrhsij proc~hypre_obj_setrhss hypre_obj%hypre_obj_SetRHSS proc~hypre_obj_setrhs->proc~hypre_obj_setrhss proc~hypre_obj_solveij hypre_obj%hypre_obj_SolveIJ proc~hypre_obj_solve->proc~hypre_obj_solveij proc~hypre_obj_solves hypre_obj%hypre_obj_SolveS proc~hypre_obj_solve->proc~hypre_obj_solves proc~bc_set_checkbcexists bc_set%bc_set_CheckBCExists proc~op_obj_applylaplaciandc->proc~bc_set_checkbcexists proc~bc_set_getbcpointer bc_set%bc_set_GetBCPointer proc~op_obj_applylaplaciandc->proc~bc_set_getbcpointer proc~bc_set_getbctype bc_set%bc_set_GetBCType proc~op_obj_applylaplaciandc->proc~bc_set_getbctype proc~bc_set_getextents bc_set%bc_set_GetExtents proc~op_obj_applylaplaciandc->proc~bc_set_getextents proc~bc_set_getsidedirbyregion bc_set%bc_set_GetSideDirByRegion proc~op_obj_applylaplaciandc->proc~bc_set_getsidedirbyregion p p proc~respart_set_getcentroidvf->p particles particles proc~respart_set_getcentroidvf->particles proc~marker_set_updatenormals marker_set%marker_set_UpdateNormals proc~respart_set_updatenormals->proc~marker_set_updatenormals proc~bc_set_getregionindex bc_set%bc_set_GetRegionIndex proc~bc_set_checkbcexists->proc~bc_set_getregionindex proc~region_obj_getbcindex region_obj%region_obj_GetBCIndex proc~bc_set_checkbcexists->proc~region_obj_getbcindex proc~bc_set_getbcpointer->proc~bc_set_getregionindex proc~bc_set_getbcpointer->proc~region_obj_getbcindex proc~bc_set_getbctype->proc~bc_set_getregionindex proc~bc_set_getbctype->proc~region_obj_getbcindex proc~bc_set_getextents->proc~bc_set_getregionindex proc~bc_set_getsidedirbyregion->proc~bc_set_getregionindex proc~bc_set_updateboundaryscalar->proc~bc_set_checkbcexists proc~bc_set_updateboundaryscalar->proc~bc_set_getbctype proc~bc_set_updateboundarydirichlet bc_set%bc_set_UpdateBoundaryDirichlet proc~bc_set_updateboundaryscalar->proc~bc_set_updateboundarydirichlet proc~bc_set_updateboundaryneumann bc_set%bc_set_UpdateBoundaryNeumann proc~bc_set_updateboundaryscalar->proc~bc_set_updateboundaryneumann proc~bc_set_updateboundarysymmetryplus bc_set%bc_set_UpdateBoundarySymmetryPlus proc~bc_set_updateboundaryscalar->proc~bc_set_updateboundarysymmetryplus proc~eulerian_obj_updateghostcells eulerian_obj_base%eulerian_obj_UpdateGhostCells proc~bc_set_updateboundaryscalar->proc~eulerian_obj_updateghostcells proc~bc_set_updateboundaryvector->proc~bc_set_checkbcexists proc~bc_set_updateboundaryvector->proc~bc_set_getbctype proc~bc_set_updateboundaryvector->proc~bc_set_getsidedirbyregion proc~bc_set_updateboundaryvector->proc~bc_set_updateboundarydirichlet proc~bc_set_updateboundaryvector->proc~bc_set_updateboundaryneumann proc~bc_set_updateboundarysymmetryminus bc_set%bc_set_UpdateBoundarySymmetryMinus proc~bc_set_updateboundaryvector->proc~bc_set_updateboundarysymmetryminus proc~bc_set_updateboundaryvector->proc~bc_set_updateboundarysymmetryplus proc~bc_set_updateboundaryvector->proc~eulerian_obj_updateghostcells hypre_ijvectorassemble hypre_ijvectorassemble proc~hypre_obj_setrhsij->hypre_ijvectorassemble hypre_ijvectorsetvalues hypre_ijvectorsetvalues proc~hypre_obj_setrhsij->hypre_ijvectorsetvalues hypre_structvectorassemble hypre_structvectorassemble proc~hypre_obj_setrhss->hypre_structvectorassemble hypre_structvectorsetvalues hypre_structvectorsetvalues proc~hypre_obj_setrhss->hypre_structvectorsetvalues hypre_boomeramggetfinalreltvres hypre_boomeramggetfinalreltvres proc~hypre_obj_solveij->hypre_boomeramggetfinalreltvres hypre_boomeramggetnumiterations hypre_boomeramggetnumiterations proc~hypre_obj_solveij->hypre_boomeramggetnumiterations hypre_boomeramgsolve hypre_boomeramgsolve proc~hypre_obj_solveij->hypre_boomeramgsolve hypre_ijvectorgetvalues hypre_ijvectorgetvalues proc~hypre_obj_solveij->hypre_ijvectorgetvalues hypre_parcsrpcggetfinalrelative hypre_parcsrpcggetfinalrelative proc~hypre_obj_solveij->hypre_parcsrpcggetfinalrelative hypre_parcsrpcggetnumiterations hypre_parcsrpcggetnumiterations proc~hypre_obj_solveij->hypre_parcsrpcggetnumiterations hypre_parcsrpcgsolve hypre_parcsrpcgsolve proc~hypre_obj_solveij->hypre_parcsrpcgsolve proc~hypre_obj_solveij->proc~eulerian_obj_updateghostcells hypre_structpcggetfinalrelative hypre_structpcggetfinalrelative proc~hypre_obj_solves->hypre_structpcggetfinalrelative hypre_structpcggetnumiterations hypre_structpcggetnumiterations proc~hypre_obj_solves->hypre_structpcggetnumiterations hypre_structpcgsolve hypre_structpcgsolve proc~hypre_obj_solves->hypre_structpcgsolve hypre_structpfmggetfinalrelativ hypre_structpfmggetfinalrelativ proc~hypre_obj_solves->hypre_structpfmggetfinalrelativ hypre_structpfmggetnumiteration hypre_structpfmggetnumiteration proc~hypre_obj_solves->hypre_structpfmggetnumiteration hypre_structpfmgsolve hypre_structpfmgsolve proc~hypre_obj_solves->hypre_structpfmgsolve hypre_structsmggetfinalrelative hypre_structsmggetfinalrelative proc~hypre_obj_solves->hypre_structsmggetfinalrelative hypre_structsmggetnumiterations hypre_structsmggetnumiterations proc~hypre_obj_solves->hypre_structsmggetnumiterations hypre_structsmgsolve hypre_structsmgsolve proc~hypre_obj_solves->hypre_structsmgsolve hypre_structvectorgetboxvalues hypre_structvectorgetboxvalues proc~hypre_obj_solves->hypre_structvectorgetboxvalues proc~marker_set_updatenormals->none~updateboundary proc~eulerian_obj_final eulerian_obj_base%eulerian_obj_Final proc~marker_set_updatenormals->proc~eulerian_obj_final proc~eulerian_obj_init eulerian_obj_base%eulerian_obj_Init proc~marker_set_updatenormals->proc~eulerian_obj_init proc~marker_set_updatenormals->proc~eulerian_obj_updateghostcells proc~marker_set_filter marker_set%marker_set_Filter proc~marker_set_updatenormals->proc~marker_set_filter none~get~3 hashtbl_obj%Get proc~bc_set_getregionindex->none~get~3 proc~hashtbl_obj_hashstring hashtbl_obj%hashtbl_obj_HashString proc~bc_set_getregionindex->proc~hashtbl_obj_hashstring proc~bc_set_updateboundarydirichlet->proc~bc_set_getbcpointer proc~bc_set_updateboundarydirichlet->proc~bc_set_getextents proc~bc_set_updateboundarydirichlet->proc~bc_set_getsidedirbyregion proc~bc_set_updateboundaryneumann->proc~bc_set_getextents proc~bc_set_updateboundaryneumann->proc~bc_set_getsidedirbyregion proc~bc_set_updateboundarysymmetryminus->proc~bc_set_getextents proc~bc_set_updateboundarysymmetryminus->proc~bc_set_getsidedirbyregion proc~bc_set_updateboundarysymmetryplus->proc~bc_set_getextents proc~bc_set_updateboundarysymmetryplus->proc~bc_set_getsidedirbyregion proc~eulerian_obj_updateghostcells_x eulerian_obj_base%eulerian_obj_UpdateGhostCells_x proc~eulerian_obj_updateghostcells->proc~eulerian_obj_updateghostcells_x proc~eulerian_obj_updateghostcells_y eulerian_obj_base%eulerian_obj_UpdateGhostCells_y proc~eulerian_obj_updateghostcells->proc~eulerian_obj_updateghostcells_y proc~eulerian_obj_updateghostcells_z eulerian_obj_base%eulerian_obj_UpdateGhostCells_z proc~eulerian_obj_updateghostcells->proc~eulerian_obj_updateghostcells_z extrapolate extrapolate proc~marker_set_filter->extrapolate f f proc~marker_set_filter->f markers markers proc~marker_set_filter->markers n n proc~marker_set_filter->n proc~eulerian_obj_addupghostcells eulerian_obj_base%eulerian_obj_AddUpGhostCells proc~marker_set_filter->proc~eulerian_obj_addupghostcells v v proc~marker_set_filter->v proc~region_obj_getbcindex->none~get~3 proc~region_obj_getbcindex->proc~hashtbl_obj_hashstring proc~hashtbl_obj_get_int4 hashtbl_obj%hashtbl_obj_Get_int4 none~get~3->proc~hashtbl_obj_get_int4 proc~hashtbl_obj_get_int8 hashtbl_obj%hashtbl_obj_Get_int8 none~get~3->proc~hashtbl_obj_get_int8 proc~hashtbl_obj_get_real_dp hashtbl_obj%hashtbl_obj_Get_real_dp none~get~3->proc~hashtbl_obj_get_real_dp proc~hashtbl_obj_get_real_sp hashtbl_obj%hashtbl_obj_Get_real_sp none~get~3->proc~hashtbl_obj_get_real_sp proc~eulerian_obj_addupghostcells->proc~eulerian_obj_updateghostcells proc~eulerian_obj_addupghostcells_x eulerian_obj_base%eulerian_obj_AddUpGhostCells_x proc~eulerian_obj_addupghostcells->proc~eulerian_obj_addupghostcells_x proc~eulerian_obj_addupghostcells_y eulerian_obj_base%eulerian_obj_AddUpGhostCells_y proc~eulerian_obj_addupghostcells->proc~eulerian_obj_addupghostcells_y proc~eulerian_obj_addupghostcells_z eulerian_obj_base%eulerian_obj_AddUpGhostCells_z proc~eulerian_obj_addupghostcells->proc~eulerian_obj_addupghostcells_z cell cell proc~eulerian_obj_updateghostcells_x->cell mpi_irecv mpi_irecv proc~eulerian_obj_updateghostcells_x->mpi_irecv mpi_isend mpi_isend proc~eulerian_obj_updateghostcells_x->mpi_isend mpi_waitall mpi_waitall proc~eulerian_obj_updateghostcells_x->mpi_waitall proc~eulerian_obj_updateghostcells_y->cell proc~eulerian_obj_updateghostcells_y->mpi_irecv proc~eulerian_obj_updateghostcells_y->mpi_isend proc~eulerian_obj_updateghostcells_y->mpi_waitall proc~eulerian_obj_updateghostcells_z->cell proc~eulerian_obj_updateghostcells_z->mpi_irecv proc~eulerian_obj_updateghostcells_z->mpi_isend proc~eulerian_obj_updateghostcells_z->mpi_waitall proc~eulerian_obj_addupghostcells_x->cell proc~eulerian_obj_addupghostcells_x->mpi_irecv proc~eulerian_obj_addupghostcells_x->mpi_isend proc~eulerian_obj_addupghostcells_x->mpi_waitall proc~eulerian_obj_addupghostcells_y->cell proc~eulerian_obj_addupghostcells_y->mpi_irecv proc~eulerian_obj_addupghostcells_y->mpi_isend proc~eulerian_obj_addupghostcells_y->mpi_waitall proc~eulerian_obj_addupghostcells_z->cell proc~eulerian_obj_addupghostcells_z->mpi_irecv proc~eulerian_obj_addupghostcells_z->mpi_isend proc~eulerian_obj_addupghostcells_z->mpi_waitall none~get~2 sllist_obj%Get proc~hashtbl_obj_get_int4->none~get~2 proc~hashtbl_obj_get_int8->none~get~2 proc~hashtbl_obj_get_real_dp->none~get~2 proc~hashtbl_obj_get_real_sp->none~get~2 proc~sllist_obj_get_int4 sllist_obj%sllist_obj_Get_int4 none~get~2->proc~sllist_obj_get_int4 proc~sllist_obj_get_int8 sllist_obj%sllist_obj_Get_int8 none~get~2->proc~sllist_obj_get_int8 proc~sllist_obj_get_real_dp sllist_obj%sllist_obj_Get_real_dp none~get~2->proc~sllist_obj_get_real_dp proc~sllist_obj_get_real_sp sllist_obj%sllist_obj_Get_real_sp none~get~2->proc~sllist_obj_get_real_sp proc~sllist_obj_get_int4->proc~sllist_obj_get_int4 proc~sllist_obj_get_int8->proc~sllist_obj_get_int8 proc~sllist_obj_get_real_dp->proc~sllist_obj_get_real_dp proc~sllist_obj_get_real_sp->proc~sllist_obj_get_real_sp

Called by

proc~~cdifs_obj_computesolidvf~~CalledByGraph proc~cdifs_obj_computesolidvf cdifs_obj%cdifs_obj_ComputeSolidVF proc~cdifs_obj_advancesolutionrp cdifs_obj_AdvanceSolutionRP proc~cdifs_obj_advancesolutionrp->proc~cdifs_obj_computesolidvf proc~cdifs_obj_preparesolver cdifs_obj_PrepareSolver proc~cdifs_obj_preparesolver->proc~cdifs_obj_computesolidvf interface~cdifs_obj_preparesolver cdifs_obj%cdifs_obj_PrepareSolver interface~cdifs_obj_preparesolver->proc~cdifs_obj_preparesolver proc~cdifs_obj_advancesolution cdifs_obj_AdvanceSolution proc~cdifs_obj_advancesolution->proc~cdifs_obj_advancesolutionrp interface~cdifs_obj_advancesolution cdifs_obj%cdifs_obj_AdvanceSolution interface~cdifs_obj_advancesolution->proc~cdifs_obj_advancesolution

Source Code

    subroutine cdifs_obj_ComputeSolidVF(this)
      !> Computes the solid volume fraction (ibVF) by solving a Poisson
      ! equation.
      ! This subroutine computes the IB normals fields, applies approriate
      ! boundary conditions, and takes the divergence, which forms the
      ! right-hand side of the poisson equation.
      ! It then uses a HYPRE solver to solve this equation.
      ! In case where the Poisson operator is singular and using resolved
      ! particles, this subroutine will apply a correction that sets the solid
      ! volume fraction at particle centroids.
      implicit none
      class(cdifs_obj), intent(inout) :: this                                  !! CDIFS solver
      ! Work variables
      integer :: i,j,k
      real(wp):: buffr
      real(wp):: vol
      real(wp):: intRHS
      real(wp):: dV

      ! Update normals
      this%ibN(1) = 0.0_wp; this%ibN(2) = 0.0_wp; this%ibN(3) = 0.0_wp
      if (this%use_RP) call this%RP%UpdateNormals(this%ibN)
      if (this%use_IB) call this%IB%UpdateNormals(this%ibN)
      call this%bcs%UpdateBoundary(this%ibN)

      ! Build right hand side of the equation and compute its integral.
      ! If no Dirichlet conditions are imposed, this needs to be close
      ! to machine precision
      intRHS = 0.0_wp
      vol    = 0.0_wp
      do k=this%block%lo(3),this%block%hi(3)
        do j=this%block%lo(2),this%block%hi(2)
          do i=this%block%lo(1),this%block%hi(1)
            this%rhs%cell(i,j,k) = - dot_product(this%op%c_d1dx1(:,i),this%ibN(1)%cell(i-this%op%st+1:i+this%op%st,j,k)) &
                                   - dot_product(this%op%c_d1dx2(:,j),this%ibN(2)%cell(i,j-this%op%st+1:j+this%op%st,k)) &
                                   - dot_product(this%op%c_d1dx3(:,k),this%ibN(3)%cell(i,j,k-this%op%st+1:k+this%op%st))

            dV     = this%block%axis(1)%dxm(i)*this%block%axis(2)%dxm(j)*this%block%axis(3)%dxm(k)
            vol    = vol + dV
            intRHS = intRHS + this%rhs%cell(i,j,k)*dV
          end do
        end do
      end do
      call this%parallel%Sum(vol,   buffr); vol    = buffr
      call this%parallel%Sum(intRHS,buffr); intRHS = buffr/vol

      ! Add Dirichlet contributions to RHS
      call this%op%ApplyLaplacianDC(this%rhs,this%bcs,'ibVF')

      ! Send RHS to HYPRE
      call this%VFSolver%SetRHS(this%rhs)

      ! Send RHS to HYPRE
      ! Solve Poisson equation with HYPRE
      call this%VFSolver%Solve(this%ibVF)

      !if (this%parallel%RankIsRoot()) then
      !  print*, 'iter:',     this%timer%iter
      !  print*, 'time:',     this%timer%time
      !  print*, 'Rel:',      this%VFSolver%rel
      !  print*, 'intRHS:',   intRHS
      !  print*, 'HYPRE it:', this%VFSolver%it
      !end if

      if (this%singularVF.and.this%use_RP) &
        this%ibVF%cell = this%ibVF%cell + (1.0_wp - this%RP%GetCentroidVF(this%ibVF))

      call this%bcs%UpdateBoundary(this%ibVF)

      return
    end subroutine cdifs_obj_ComputeSolidVF