petsc macros can be omitted with use of preal

This commit is contained in:
Daniel Otto de Mentock 2022-12-05 10:38:36 +01:00
parent a2f898a94c
commit c2e78158c8
4 changed files with 26 additions and 33 deletions

View File

@ -288,15 +288,13 @@ end subroutine grid_damage_spectral_forward
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Construct the residual vector. !> @brief Construct the residual vector.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine formResidual(in,x_scal,r,dummy,err_PETSc) subroutine formResidual(residual_subdomain,x_scal,r,dummy,err_PETSc)
DMDALocalInfo, dimension(DMDA_LOCAL_INFO_SIZE) :: & DMDALocalInfo, dimension(DMDA_LOCAL_INFO_SIZE) :: &
in residual_subdomain
real(pReal), dimension( & real(pReal), dimension(cells(1),cells(2),cells3), intent(in) :: &
XG_RANGE,YG_RANGE,ZG_RANGE), intent(in) :: &
x_scal x_scal
real(pReal), dimension( & real(pReal), dimension(cells(1),cells(2),cells3), intent(out) :: &
X_RANGE,Y_RANGE,Z_RANGE), intent(out) :: &
r !< residual r !< residual
PetscObject :: dummy PetscObject :: dummy
PetscErrorCode, intent(out) :: err_PETSc PetscErrorCode, intent(out) :: err_PETSc

View File

@ -496,14 +496,15 @@ end subroutine converged
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Construct the residual vector. !> @brief Construct the residual vector.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine formResidual(in, F, & subroutine formResidual(residual_subdomain, F, &
r, dummy, err_PETSc) r, dummy, err_PETSc)
DMDALocalInfo, dimension(DMDA_LOCAL_INFO_SIZE) :: in !< DMDA info (needs to be named "in" for macros like XRANGE to work) DMDALocalInfo, dimension(DMDA_LOCAL_INFO_SIZE) :: &
real(pReal), dimension(3,3,XG_RANGE,YG_RANGE,ZG_RANGE), & residual_subdomain !< DMDA info (needs to be named "in" for macros like XRANGE to work)
intent(in) :: F !< deformation gradient field real(pReal), dimension(3,3,cells(1),cells(2),cells3), intent(in) :: &
real(pReal), dimension(3,3,X_RANGE,Y_RANGE,Z_RANGE), & F !< deformation gradient field
intent(out) :: r !< residuum field real(pReal), dimension(3,3,cells(1),cells(2),cells3), intent(out) :: &
r !< residuum field
PetscObject :: dummy PetscObject :: dummy
PetscErrorCode :: err_PETSc PetscErrorCode :: err_PETSc

View File

@ -558,14 +558,14 @@ end subroutine converged
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Construct the residual vector. !> @brief Construct the residual vector.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine formResidual(in, FandF_tau, & subroutine formResidual(residual_subdomain, FandF_tau, &
r, dummy,err_PETSc) r, dummy,err_PETSc)
DMDALocalInfo, dimension(DMDA_LOCAL_INFO_SIZE) :: in !< DMDA info (needs to be named "in" for macros like XRANGE to work) DMDALocalInfo, dimension(DMDA_LOCAL_INFO_SIZE) :: residual_subdomain !< DMDA info (needs to be named "in" for macros like XRANGE to work)
real(pReal), dimension(3,3,2,XG_RANGE,YG_RANGE,ZG_RANGE), & real(pReal), dimension(3,3,2,cells(1),cells(2),cells3), target, intent(in) :: &
target, intent(in) :: FandF_tau FandF_tau !< deformation gradient field
real(pReal), dimension(3,3,2,X_RANGE,Y_RANGE,Z_RANGE),& real(pReal), dimension(3,3,2,cells(1),cells(2),cells3), target, intent(out) :: &
target, intent(out) :: r !< residuum field r !< residuum field
PetscObject :: dummy PetscObject :: dummy
PetscErrorCode :: err_PETSc PetscErrorCode :: err_PETSc
@ -582,14 +582,10 @@ subroutine formResidual(in, FandF_tau, &
i, j, k, e i, j, k, e
F => FandF_tau(1:3,1:3,1,& F => FandF_tau(1:3,1:3,1,1:cells(1),1:cells(2),1:cells3)
XG_RANGE,YG_RANGE,ZG_RANGE) F_tau => FandF_tau(1:3,1:3,2,1:cells(1),1:cells(2),1:cells3)
F_tau => FandF_tau(1:3,1:3,2,& r_F => r(1:3,1:3,1,1:cells(1),1:cells(2),1:cells3)
XG_RANGE,YG_RANGE,ZG_RANGE) r_F_tau => r(1:3,1:3,2,1:cells(1),1:cells(2),1:cells3)
r_F => r(1:3,1:3,1,&
X_RANGE, Y_RANGE, Z_RANGE)
r_F_tau => r(1:3,1:3,2,&
X_RANGE, Y_RANGE, Z_RANGE)
F_av = sum(sum(sum(F,dim=5),dim=4),dim=3) * wgt F_av = sum(sum(sum(F,dim=5),dim=4),dim=3) * wgt
call MPI_Allreduce(MPI_IN_PLACE,F_av,9_MPI_INTEGER_KIND,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD,err_MPI) call MPI_Allreduce(MPI_IN_PLACE,F_av,9_MPI_INTEGER_KIND,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD,err_MPI)

View File

@ -315,16 +315,14 @@ end subroutine grid_thermal_spectral_restartWrite
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief forms the spectral thermal residual vector !> @brief forms the spectral thermal residual vector
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine formResidual(in,x_scal,r,dummy,err_PETSc) subroutine formResidual(residual_subdomain,x_scal,r,dummy,err_PETSc)
DMDALocalInfo, dimension(DMDA_LOCAL_INFO_SIZE) :: & DMDALocalInfo, dimension(DMDA_LOCAL_INFO_SIZE) :: &
in residual_subdomain
real(pReal), dimension( & real(pReal), dimension(cells(1),cells(2),cells3), intent(in) :: &
XG_RANGE,YG_RANGE,ZG_RANGE), intent(in) :: &
x_scal x_scal
real(pReal), dimension( & real(pReal), dimension(cells(1),cells(2),cells3), intent(out) :: &
X_RANGE,Y_RANGE,Z_RANGE), intent(out) :: & r !< residual
r !< residual
PetscObject :: dummy PetscObject :: dummy
PetscErrorCode, intent(out) :: err_PETSc PetscErrorCode, intent(out) :: err_PETSc