From c2e78158c8b31c0c7ac659a7b111ea63ce14e213 Mon Sep 17 00:00:00 2001 From: Daniel Otto de Mentock Date: Mon, 5 Dec 2022 10:38:36 +0100 Subject: [PATCH] petsc macros can be omitted with use of preal --- src/grid/grid_damage_spectral.f90 | 10 ++++---- src/grid/grid_mech_spectral_basic.f90 | 13 ++++++----- src/grid/grid_mech_spectral_polarisation.f90 | 24 ++++++++------------ src/grid/grid_thermal_spectral.f90 | 12 ++++------ 4 files changed, 26 insertions(+), 33 deletions(-) diff --git a/src/grid/grid_damage_spectral.f90 b/src/grid/grid_damage_spectral.f90 index 91be2cdc1..e2542d722 100644 --- a/src/grid/grid_damage_spectral.f90 +++ b/src/grid/grid_damage_spectral.f90 @@ -288,15 +288,13 @@ end subroutine grid_damage_spectral_forward !-------------------------------------------------------------------------------------------------- !> @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) :: & - in - real(pReal), dimension( & - XG_RANGE,YG_RANGE,ZG_RANGE), intent(in) :: & + residual_subdomain + real(pReal), dimension(cells(1),cells(2),cells3), intent(in) :: & x_scal - real(pReal), dimension( & - X_RANGE,Y_RANGE,Z_RANGE), intent(out) :: & + real(pReal), dimension(cells(1),cells(2),cells3), intent(out) :: & r !< residual PetscObject :: dummy PetscErrorCode, intent(out) :: err_PETSc diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index fd0e941c7..e337376ca 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -496,14 +496,15 @@ end subroutine converged !-------------------------------------------------------------------------------------------------- !> @brief Construct the residual vector. !-------------------------------------------------------------------------------------------------- -subroutine formResidual(in, F, & +subroutine formResidual(residual_subdomain, F, & r, dummy, err_PETSc) - DMDALocalInfo, dimension(DMDA_LOCAL_INFO_SIZE) :: in !< DMDA info (needs to be named "in" for macros like XRANGE to work) - real(pReal), dimension(3,3,XG_RANGE,YG_RANGE,ZG_RANGE), & - intent(in) :: F !< deformation gradient field - real(pReal), dimension(3,3,X_RANGE,Y_RANGE,Z_RANGE), & - intent(out) :: r !< residuum field + 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,cells(1),cells(2),cells3), intent(in) :: & + F !< deformation gradient field + real(pReal), dimension(3,3,cells(1),cells(2),cells3), intent(out) :: & + r !< residuum field PetscObject :: dummy PetscErrorCode :: err_PETSc diff --git a/src/grid/grid_mech_spectral_polarisation.f90 b/src/grid/grid_mech_spectral_polarisation.f90 index 67edf992b..bac8696ab 100644 --- a/src/grid/grid_mech_spectral_polarisation.f90 +++ b/src/grid/grid_mech_spectral_polarisation.f90 @@ -558,14 +558,14 @@ end subroutine converged !-------------------------------------------------------------------------------------------------- !> @brief Construct the residual vector. !-------------------------------------------------------------------------------------------------- -subroutine formResidual(in, FandF_tau, & +subroutine formResidual(residual_subdomain, FandF_tau, & r, dummy,err_PETSc) - DMDALocalInfo, dimension(DMDA_LOCAL_INFO_SIZE) :: in !< 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), & - target, intent(in) :: FandF_tau - real(pReal), dimension(3,3,2,X_RANGE,Y_RANGE,Z_RANGE),& - target, intent(out) :: r !< residuum field + 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,cells(1),cells(2),cells3), target, intent(in) :: & + FandF_tau !< deformation gradient field + real(pReal), dimension(3,3,2,cells(1),cells(2),cells3), target, intent(out) :: & + r !< residuum field PetscObject :: dummy PetscErrorCode :: err_PETSc @@ -582,14 +582,10 @@ subroutine formResidual(in, FandF_tau, & i, j, k, e - F => FandF_tau(1:3,1:3,1,& - XG_RANGE,YG_RANGE,ZG_RANGE) - F_tau => FandF_tau(1:3,1:3,2,& - XG_RANGE,YG_RANGE,ZG_RANGE) - 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 => FandF_tau(1:3,1:3,1,1:cells(1),1:cells(2),1:cells3) + F_tau => FandF_tau(1:3,1:3,2,1:cells(1),1:cells(2),1:cells3) + r_F => r(1:3,1:3,1,1:cells(1),1:cells(2),1:cells3) + r_F_tau => r(1:3,1:3,2,1:cells(1),1:cells(2),1:cells3) 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) diff --git a/src/grid/grid_thermal_spectral.f90 b/src/grid/grid_thermal_spectral.f90 index 474d18196..063028ee1 100644 --- a/src/grid/grid_thermal_spectral.f90 +++ b/src/grid/grid_thermal_spectral.f90 @@ -315,16 +315,14 @@ end subroutine grid_thermal_spectral_restartWrite !-------------------------------------------------------------------------------------------------- !> @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) :: & - in - real(pReal), dimension( & - XG_RANGE,YG_RANGE,ZG_RANGE), intent(in) :: & + residual_subdomain + real(pReal), dimension(cells(1),cells(2),cells3), intent(in) :: & x_scal - real(pReal), dimension( & - X_RANGE,Y_RANGE,Z_RANGE), intent(out) :: & - r !< residual + real(pReal), dimension(cells(1),cells(2),cells3), intent(out) :: & + r !< residual PetscObject :: dummy PetscErrorCode, intent(out) :: err_PETSc