From 7b1080fdb72f7c43ac40b63f108dbbbef83f84dd Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 20 Jan 2022 07:42:16 +0100 Subject: [PATCH] better and consistent variable name --- src/grid/grid_damage_spectral.f90 | 6 ++--- src/grid/grid_mech_FEM.f90 | 28 ++++++++++---------- src/grid/grid_mech_spectral_basic.f90 | 10 +++---- src/grid/grid_mech_spectral_polarisation.f90 | 12 ++++----- src/grid/grid_thermal_spectral.f90 | 6 ++--- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/grid/grid_damage_spectral.f90 b/src/grid/grid_damage_spectral.f90 index 9ed1dd051..c8029b5a9 100644 --- a/src/grid/grid_damage_spectral.f90 +++ b/src/grid/grid_damage_spectral.f90 @@ -253,7 +253,7 @@ end subroutine grid_damage_spectral_forward !-------------------------------------------------------------------------------------------------- !> @brief forms the spectral damage residual vector !-------------------------------------------------------------------------------------------------- -subroutine formResidual(in,x_scal,f_scal,dummy,dummy_err) +subroutine formResidual(in,x_scal,r,dummy,dummy_err) DMDALocalInfo, dimension(DMDA_LOCAL_INFO_SIZE) :: & in @@ -262,7 +262,7 @@ subroutine formResidual(in,x_scal,f_scal,dummy,dummy_err) x_scal PetscScalar, dimension( & X_RANGE,Y_RANGE,Z_RANGE), intent(out) :: & - f_scal + r PetscObject :: dummy PetscErrorCode :: dummy_err integer :: i, j, k, ce @@ -305,7 +305,7 @@ subroutine formResidual(in,x_scal,f_scal,dummy,dummy_err) !-------------------------------------------------------------------------------------------------- ! constructing residual - f_scal = scalarField_real(1:grid(1),1:grid(2),1:grid3) - phi_current + r = scalarField_real(1:grid(1),1:grid(2),1:grid3) - phi_current end subroutine formResidual diff --git a/src/grid/grid_mech_FEM.f90 b/src/grid/grid_mech_FEM.f90 index ed0d01810..565cde36d 100644 --- a/src/grid/grid_mech_FEM.f90 +++ b/src/grid/grid_mech_FEM.f90 @@ -521,7 +521,7 @@ subroutine formResidual(da_local,x_local, & DM :: da_local Vec :: x_local, f_local - PetscScalar, pointer,dimension(:,:,:,:) :: x_scal, f_scal + PetscScalar, pointer,dimension(:,:,:,:) :: x_scal, r PetscScalar, dimension(8,3) :: x_elem, f_elem PetscInt :: i, ii, j, jj, k, kk, ctr, ele PetscInt :: & @@ -580,7 +580,7 @@ subroutine formResidual(da_local,x_local, & !-------------------------------------------------------------------------------------------------- ! constructing residual call VecSet(f_local,0.0_pReal,err_PETSc);CHKERRQ(err_PETSc) - call DMDAVecGetArrayF90(da_local,f_local,f_scal,err_PETSc);CHKERRQ(err_PETSc) + call DMDAVecGetArrayF90(da_local,f_local,r,err_PETSc);CHKERRQ(err_PETSc) call DMDAVecGetArrayF90(da_local,x_local,x_scal,err_PETSc);CHKERRQ(err_PETSc) ele = 0 do k = grid3offset+1, grid3offset+grid3; do j = 1, grid(2); do i = 1, grid(1) @@ -597,28 +597,28 @@ subroutine formResidual(da_local,x_local, & ctr = 0 do kk = -1, 0; do jj = -1, 0; do ii = -1, 0 ctr = ctr + 1 - f_scal(0:2,i+ii,j+jj,k+kk) = f_scal(0:2,i+ii,j+jj,k+kk) + f_elem(ctr,1:3) + r(0:2,i+ii,j+jj,k+kk) = r(0:2,i+ii,j+jj,k+kk) + f_elem(ctr,1:3) enddo; enddo; enddo enddo; enddo; enddo call DMDAVecRestoreArrayF90(da_local,x_local,x_scal,err_PETSc);CHKERRQ(err_PETSc) - call DMDAVecRestoreArrayF90(da_local,f_local,f_scal,err_PETSc);CHKERRQ(err_PETSc) + call DMDAVecRestoreArrayF90(da_local,f_local,r,err_PETSc);CHKERRQ(err_PETSc) !-------------------------------------------------------------------------------------------------- ! applying boundary conditions - call DMDAVecGetArrayF90(da_local,f_local,f_scal,err_PETSc);CHKERRQ(err_PETSc) + call DMDAVecGetArrayF90(da_local,f_local,r,err_PETSc);CHKERRQ(err_PETSc) if (grid3offset == 0) then - f_scal(0:2,0, 0, 0) = 0.0_pReal - f_scal(0:2,grid(1),0, 0) = 0.0_pReal - f_scal(0:2,0, grid(2),0) = 0.0_pReal - f_scal(0:2,grid(1),grid(2),0) = 0.0_pReal + r(0:2,0, 0, 0) = 0.0_pReal + r(0:2,grid(1),0, 0) = 0.0_pReal + r(0:2,0, grid(2),0) = 0.0_pReal + r(0:2,grid(1),grid(2),0) = 0.0_pReal end if if (grid3+grid3offset == grid(3)) then - f_scal(0:2,0, 0, grid(3)) = 0.0_pReal - f_scal(0:2,grid(1),0, grid(3)) = 0.0_pReal - f_scal(0:2,0, grid(2),grid(3)) = 0.0_pReal - f_scal(0:2,grid(1),grid(2),grid(3)) = 0.0_pReal + r(0:2,0, 0, grid(3)) = 0.0_pReal + r(0:2,grid(1),0, grid(3)) = 0.0_pReal + r(0:2,0, grid(2),grid(3)) = 0.0_pReal + r(0:2,grid(1),grid(2),grid(3)) = 0.0_pReal end if - call DMDAVecRestoreArrayF90(da_local,f_local,f_scal,err_PETSc);CHKERRQ(err_PETSc) + call DMDAVecRestoreArrayF90(da_local,f_local,r,err_PETSc);CHKERRQ(err_PETSc) end subroutine formResidual diff --git a/src/grid/grid_mech_spectral_basic.f90 b/src/grid/grid_mech_spectral_basic.f90 index 56c619b7e..6486e22f1 100644 --- a/src/grid/grid_mech_spectral_basic.f90 +++ b/src/grid/grid_mech_spectral_basic.f90 @@ -465,13 +465,13 @@ end subroutine converged !> @brief forms the residual vector !-------------------------------------------------------------------------------------------------- subroutine formResidual(in, F, & - residuum, 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) PetscScalar, dimension(3,3,XG_RANGE,YG_RANGE,ZG_RANGE), & intent(in) :: F !< deformation gradient field PetscScalar, dimension(3,3,X_RANGE,Y_RANGE,Z_RANGE), & - intent(out) :: residuum !< residuum field + intent(out) :: r !< residuum field real(pReal), dimension(3,3) :: & deltaF_aim PetscInt :: & @@ -500,7 +500,7 @@ subroutine formResidual(in, F, & !-------------------------------------------------------------------------------------------------- ! evaluate constitutive response - call utilities_constitutiveResponse(residuum, & ! "residuum" gets field of first PK stress (to save memory) + call utilities_constitutiveResponse(r, & ! residuum gets field of first PK stress (to save memory) P_av,C_volAvg,C_minMaxAvg, & F,params%Delta_t,params%rotation_BC) call MPI_Allreduce(MPI_IN_PLACE,terminallyIll,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI) @@ -515,7 +515,7 @@ subroutine formResidual(in, F, & !-------------------------------------------------------------------------------------------------- ! updated deformation gradient using fix point algorithm of basic scheme tensorField_real = 0.0_pReal - tensorField_real(1:3,1:3,1:grid(1),1:grid(2),1:grid3) = residuum ! store fPK field for subsequent FFT forward transform + tensorField_real(1:3,1:3,1:grid(1),1:grid(2),1:grid3) = r ! store fPK field for subsequent FFT forward transform call utilities_FFTtensorForward ! FFT forward of global "tensorField_real" err_div = utilities_divergenceRMS() ! divRMS of tensorField_fourier for later use call utilities_fourierGammaConvolution(params%rotation_BC%rotate(deltaF_aim,active=.true.)) ! convolution of Gamma and tensorField_fourier @@ -523,7 +523,7 @@ subroutine formResidual(in, F, & !-------------------------------------------------------------------------------------------------- ! constructing residual - residuum = tensorField_real(1:3,1:3,1:grid(1),1:grid(2),1:grid3) ! Gamma*P gives correction towards div(P) = 0, so needs to be zero, too + r = tensorField_real(1:3,1:3,1:grid(1),1:grid(2),1:grid3) ! Gamma*P gives correction towards div(P) = 0, so needs to be zero, too end subroutine formResidual diff --git a/src/grid/grid_mech_spectral_polarisation.f90 b/src/grid/grid_mech_spectral_polarisation.f90 index ccd26f451..a541f2882 100644 --- a/src/grid/grid_mech_spectral_polarisation.f90 +++ b/src/grid/grid_mech_spectral_polarisation.f90 @@ -531,13 +531,13 @@ end subroutine converged !> @brief forms the residual vector !-------------------------------------------------------------------------------------------------- subroutine formResidual(in, FandF_tau, & - residuum, 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) PetscScalar, dimension(3,3,2,XG_RANGE,YG_RANGE,ZG_RANGE), & target, intent(in) :: FandF_tau PetscScalar, dimension(3,3,2,X_RANGE,Y_RANGE,Z_RANGE),& - target, intent(out) :: residuum !< residuum field + target, intent(out) :: r !< residuum field PetscScalar, pointer, dimension(:,:,:,:,:) :: & F, & F_tau, & @@ -558,10 +558,10 @@ subroutine formResidual(in, FandF_tau, & XG_RANGE,YG_RANGE,ZG_RANGE) F_tau => FandF_tau(1:3,1:3,2,& XG_RANGE,YG_RANGE,ZG_RANGE) - residual_F => residuum(1:3,1:3,1,& - X_RANGE, Y_RANGE, Z_RANGE) - residual_F_tau => residuum(1:3,1:3,2,& - X_RANGE, Y_RANGE, Z_RANGE) + residual_F => r(1:3,1:3,1,& + X_RANGE, Y_RANGE, Z_RANGE) + residual_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 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 ea32f3b68..389ff10f4 100644 --- a/src/grid/grid_thermal_spectral.f90 +++ b/src/grid/grid_thermal_spectral.f90 @@ -250,7 +250,7 @@ end subroutine grid_thermal_spectral_forward !-------------------------------------------------------------------------------------------------- !> @brief forms the spectral thermal residual vector !-------------------------------------------------------------------------------------------------- -subroutine formResidual(in,x_scal,f_scal,dummy,dummy_err) +subroutine formResidual(in,x_scal,r,dummy,dummy_err) DMDALocalInfo, dimension(DMDA_LOCAL_INFO_SIZE) :: & in @@ -259,7 +259,7 @@ subroutine formResidual(in,x_scal,f_scal,dummy,dummy_err) x_scal PetscScalar, dimension( & X_RANGE,Y_RANGE,Z_RANGE), intent(out) :: & - f_scal + r PetscObject :: dummy PetscErrorCode :: dummy_err integer :: i, j, k, ce @@ -296,7 +296,7 @@ subroutine formResidual(in,x_scal,f_scal,dummy,dummy_err) !-------------------------------------------------------------------------------------------------- ! constructing residual - f_scal = T_current - scalarField_real(1:grid(1),1:grid(2),1:grid3) + r = T_current - scalarField_real(1:grid(1),1:grid(2),1:grid3) end subroutine formResidual