Skip to content

Commit 8c42662

Browse files
committed
Merge branch 'PETSc-3.22-compatible' into 'development'
adjustments for PETSc 3.22.x See merge request damask/DAMASK!981
2 parents 4e070e5 + e8ad7b3 commit 8c42662

7 files changed

+36
-10
lines changed

.github/workflows/Fortran.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Grid and Mesh Solver
22
on: [push]
33

44
env:
5-
PETSC_VERSION: '3.21.4'
5+
PETSC_VERSION: '3.22.0'
66
HOMEBREW_NO_ANALYTICS: 'ON' # Make Homebrew installation a little quicker
77
HOMEBREW_NO_AUTO_UPDATE: 'ON'
88
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: 'ON'

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ endif()
1111
project(Prerequisites LANGUAGES)
1212
set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
1313
pkg_check_modules(PETSC_MIN REQUIRED PETSc>=3.12.0 QUIET) #CMake does not support version range
14-
pkg_check_modules(PETSC REQUIRED PETSc<3.22.0)
14+
pkg_check_modules(PETSC REQUIRED PETSc<3.23.0)
1515

1616
pkg_get_variable(CMAKE_Fortran_COMPILER PETSc fcompiler)
1717
pkg_get_variable(CMAKE_C_COMPILER PETSc ccompiler)

src/CLI.f90

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
!> @brief Parse command line interface for PETSc-based solvers
77
!--------------------------------------------------------------------------------------------------
88
#define PETSC_MINOR_MIN 12
9-
#define PETSC_MINOR_MAX 21
9+
#define PETSC_MINOR_MAX 22
1010

1111
module CLI
1212
use, intrinsic :: ISO_fortran_env

src/grid/grid_mech_spectral_Galerkin.f90

+6-1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ subroutine MatShellSetOperation(mat,op_num,op_callback,ierr)
135135
end subroutine MatShellSetOperation
136136
end interface MatShellSetOperation
137137

138+
#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR<22)
138139
interface SNESSetJacobian
139140
subroutine SNESSetJacobian(snes_mech,A,P,jac_callback,ctx,ierr)
140141
use petscsnes
@@ -145,6 +146,7 @@ subroutine SNESSetJacobian(snes_mech,A,P,jac_callback,ctx,ierr)
145146
PetscErrorCode :: ierr
146147
end subroutine SNESSetJacobian
147148
end interface SNESSetJacobian
149+
#endif
148150

149151
interface SNESSetUpdate
150152
subroutine SNESSetUpdate(snes_mech,upd_callback,ierr)
@@ -678,14 +680,17 @@ end subroutine GK_op
678680
subroutine set_F_aim(snes, step, ierr)
679681
SNES :: snes
680682
PetscInt :: step ! curr completed petsc iter
681-
PetscErrorCode :: ierr
683+
PetscErrorCode, intent(out) :: ierr
684+
682685

683686
real(pREAL), dimension(3,3) :: &
684687
deltaF_aim
685688

686689
deltaF_aim = math_mul3333xx33(S, P_av - P_aim)
687690
F_aim = F_aim - deltaF_aim
688691

692+
ierr = 0_pPETSCERRORCODE
693+
689694
end subroutine set_F_aim
690695

691696
end module grid_mechanical_spectral_Galerkin

src/mesh/discretization_mesh.f90

+10
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,25 @@ subroutine discretization_mesh_init()
179179
#else
180180
call PetscDTSimplexQuadrature(dimplex, p_i, -1, quadrature, err_PETSc)
181181
CHKERRQ(err_PETSc)
182+
#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>=22)
183+
call PetscQuadratureGetData(quadrature,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER, &
184+
mesh_maxNips,qPointsP,PETSC_NULL_REAL_PTR,err_PETSc)
185+
#else
182186
call PetscQuadratureGetData(quadrature,PETSC_NULL_INTEGER(1),PETSC_NULL_INTEGER(1), &
183187
mesh_maxNips,qPointsP,PETSC_NULL_REAL_PTR,err_PETSc)
188+
#endif
184189
CHKERRQ(err_PETSc)
185190

186191
call mesh_FEM_build_ipCoordinates(dimPlex,qPointsP)
187192
call mesh_FEM_build_ipVolumes(dimPlex)
188193

194+
#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>=22)
195+
call PetscQuadratureRestoreData(quadrature,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER, &
196+
PETSC_NULL_INTEGER,qPointsP,PETSC_NULL_REAL_PTR,err_PETSc)
197+
#else
189198
call PetscQuadratureRestoreData(quadrature,PETSC_NULL_INTEGER(1),PETSC_NULL_INTEGER(1), &
190199
PETSC_NULL_INTEGER(1),qPointsP,PETSC_NULL_REAL_PTR,err_PETSc)
200+
#endif
191201
CHKERRQ(err_PETSc)
192202
call PetscQuadratureDestroy(quadrature, err_PETSc)
193203
CHKERRQ(err_PETSc)

src/mesh/mesh_mech_FEM.f90

+10
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,23 @@ subroutine FEM_mechanical_init(mechBC,num_mesh)
179179
#else
180180
call PetscDTSimplexQuadrature(dimplex,num%p_i,-1,mechQuad,err_PETSc)
181181
CHKERRQ(err_PETSc)
182+
#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>=22)
183+
call PetscQuadratureGetData(mechQuad,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER, &
184+
nQuadrature,PETSC_NULL_REAL_PTR,qWeightsP,err_PETSc)
185+
CHKERRQ(err_PETSc)
186+
qWeights = qWeightsP
187+
call PetscQuadratureRestoreData(mechQuad,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER, &
188+
PETSC_NULL_INTEGER,PETSC_NULL_REAL_PTR,qWeightsP, &
189+
err_PETSc)
190+
#else
182191
call PetscQuadratureGetData(mechQuad,PETSC_NULL_INTEGER(1),PETSC_NULL_INTEGER(1), &
183192
nQuadrature,PETSC_NULL_REAL_PTR,qWeightsP,err_PETSc)
184193
CHKERRQ(err_PETSc)
185194
qWeights = qWeightsP
186195
call PetscQuadratureRestoreData(mechQuad,PETSC_NULL_INTEGER(1),PETSC_NULL_INTEGER(1), &
187196
PETSC_NULL_INTEGER(1),PETSC_NULL_REAL_PTR,qWeightsP, &
188197
err_PETSc)
198+
#endif
189199
CHKERRQ(err_PETSc)
190200
nc = dimPlex
191201
#endif

src/prec.f90

+7-6
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ module prec
2323
integer, parameter :: pI32 = selected_int_kind(9) !< number with at least up to +-1e9 (typically 32 bit)
2424
integer, parameter :: pI64 = selected_int_kind(18) !< number with at least up to +-1e18 (typically 64 bit)
2525
#ifdef PETSC
26-
PetscInt, private :: dummy_int
27-
integer, parameter :: pPETSCINT = kind(dummy_int)
28-
PetscScalar, private :: dummy_scalar
29-
real(pREAL), parameter, private :: pPETSCSCALAR = kind(dummy_scalar)
26+
PetscInt, private :: dummy_int
27+
PetscErrorCode, private :: dummy_error_code
28+
integer, parameter :: pPETSCINT = kind(dummy_int)
29+
integer, parameter :: pPETSCERRORCODE = kind(dummy_error_code)
3030
#endif
3131
integer, parameter :: pSTRLEN = 256 !< default string length
3232
integer, parameter :: pPATHLEN = 4096 !< maximum length of a path name on linux
@@ -251,10 +251,11 @@ subroutine prec_selfTest()
251251
real(pREAL), dimension(1) :: f
252252
integer(pI64), dimension(1) :: i
253253
real(pREAL), dimension(2) :: r
254+
#ifdef PETSC
255+
PetscScalar :: dummy_scalar
254256

255257

256-
#ifdef PETSC
257-
if (pREAL /= pPETSCSCALAR) error stop 'PETSc and DAMASK scalar datatypes do not match'
258+
if (pREAL /= kind(dummy_scalar)) error stop 'PETSc and DAMASK scalar datatypes do not match'
258259
#endif
259260
realloc_lhs_test = [1,2]
260261
if (any(realloc_lhs_test/=[1,2])) error stop 'LHS allocation'

0 commit comments

Comments
 (0)