ScalarVolumeIntegral Function

public function ScalarVolumeIntegral(mesh, integralType) result(val)

Arguments

Type IntentOptional Attributes Name
class(HexMesh), intent(in) :: mesh
integer, intent(in) :: integralType

Return Value real(kind=RP)


Source Code

      function ScalarVolumeIntegral(mesh, integralType) result(val)
!
!        -----------------------------------------------------------
!           This function computes scalar integrals, that is, those
!           in the form:
!                 val = \int v dx
!        -----------------------------------------------------------
!

         implicit none
         class(HexMesh),      intent(in)  :: mesh
         integer,             intent(in)  :: integralType
         real(kind=RP)                    :: val
!
!        ---------------
!        Local variables
!        ---------------
!
         real(kind=RP) :: localVal
         integer       :: eID, ierr

!
!        Initialization
!        --------------
         val = 0.0_RP
!
!        Loop the mesh
!        -------------
!$omp parallel do reduction(+:val) private(eID) schedule(guided)
         do eID = 1, mesh % no_of_elements
!
!           Compute the integral
!           --------------------
            val = val + ScalarVolumeIntegral_Local(mesh % elements(eID), &
                                                           integralType    )

         end do
!$omp end parallel do

#ifdef _HAS_MPI_
            localVal = val
            call mpi_allreduce(localVal, val, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD, ierr)
#endif

      end function ScalarVolumeIntegral