cdifs_obj_AdvanceSolutionBodyForce Subroutine

subroutine cdifs_obj_AdvanceSolutionBodyForce(this)

Computes bodyforces based on old state.

Arguments

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

CDIFS solver


Calls

proc~~cdifs_obj_advancesolutionbodyforce~~CallsGraph proc~cdifs_obj_advancesolutionbodyforce cdifs_obj_AdvanceSolutionBodyForce cpg cpg proc~cdifs_obj_advancesolutionbodyforce->cpg

Called by

proc~~cdifs_obj_advancesolutionbodyforce~~CalledByGraph proc~cdifs_obj_advancesolutionbodyforce cdifs_obj_AdvanceSolutionBodyForce proc~cdifs_obj_advancesolution cdifs_obj_AdvanceSolution proc~cdifs_obj_advancesolution->proc~cdifs_obj_advancesolutionbodyforce interface~cdifs_obj_advancesolution cdifs_obj%cdifs_obj_AdvanceSolution interface~cdifs_obj_advancesolution->proc~cdifs_obj_advancesolution

Source Code

    subroutine cdifs_obj_AdvanceSolutionBodyForce(this)
      !> Computes bodyforces based on old state.
      implicit none
      class(cdifs_obj), intent(inout) :: this                                  !! CDIFS solver
      ! Work variables
      integer :: dir
      integer :: i,j,k

      ! Remove any old forcing
      do dir=1,3
        this%srcV(dir) = 0.0_wp
      end do

      ! Update forcing
      select type(bodyforce=>this%bodyforce)
      type is (bodyforce_NONE)
        ! Nothing to do
      type is (bodyforce_CPG)
        ! Apply constant pressure gradient forcing
        associate ( V => this%V, srcV => this%srcV,  &
          lo => this%block%lo, hi => this%block%hi   )

          do dir=1,3
            do k=lo(3),hi(3)
              do j=lo(2),hi(2)
                do i=lo(1),hi(1)
                  if (this%maskV(dir)%cell(i,j,k)>0) &
                    srcV(dir)%cell(i,j,k) = srcV(dir)%cell(i,j,k) - bodyforce%CPG(dir)/this%rho
                end do
              end do
            end do
          end do

        end associate
      end select

      return
    end subroutine cdifs_obj_AdvanceSolutionBodyForce