Skip to content
GitLab
Explore
Sign in
Register
This is an archived project. Repository and other project resources are read-only.
Commits on Source (3)
STYLE: update to use PETSC_SUCCESS in PetscFunctionReturn
· c0fdf97c
Junchao Zhang
authored
Nov 26, 2024
and
Mark OLESEN
committed
Jan 09, 2025
c0fdf97c
BUG: Must access PC earlier
· 8e824c16
Junchao Zhang
authored
Nov 26, 2024
and
Mark OLESEN
committed
Jan 09, 2025
8e824c16
Merge branch 'stefanozampini/junchao-fixes' into 'main'
· 090b5a74
Mark OLESEN
authored
Jan 09, 2025
bugfixes from PETSc's developer Junchao Zhang See merge request
!14
090b5a74
Hide whitespace changes
Inline
Side-by-side
src/petsc4Foam/solvers/petscSolver.C
View file @
090b5a74
...
...
@@ -323,11 +323,11 @@ Foam::solverPerformance Foam::petscSolver::scalarSolve
void
(
*
f
)(
void
)
=
NULL
;
PetscBool
hypre_device
=
PETSC_FALSE
;
AssertPETSc
(
KSPGetPC
(
ksp
,
&
pc
));
PetscObjectQueryFunction
((
PetscObject
)
pc
,
"PCSetCoordinates_C"
,
&
f
);
#ifdef PETSC_HAVE_HYPRE_DEVICE
AssertPETSc
(
PetscObjectTypeCompare
((
PetscObject
)
pc
,
PCHYPRE
,
&
hypre_device
));
#endif
AssertPETSc
(
KSPGetPC
(
ksp
,
&
pc
));
PetscObjectQueryFunction
((
PetscObject
)
pc
,
"PCSetCoordinates_C"
,
&
f
);
// Cell-centres are contiguous in memory (array of structures)
// Not sure about const-ness here
...
...
src/petsc4Foam/utils/petscUtils.C
View file @
090b5a74
...
...
@@ -39,6 +39,11 @@ License
#define PetscInt_FMT "D"
#endif
// For PETSc < 3.19.0
#ifndef PETSC_SUCCESS
#define PETSC_SUCCESS 0
#endif
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
Foam
::
solveScalar
Foam
::
gAverage
(
Vec
input
)
...
...
@@ -133,6 +138,7 @@ Foam::scalar Foam::PetscUtils::normFactor
);
}
PetscErrorCode
Foam
::
PetscUtils
::
foamKSPMonitorFoam
(
KSP
ksp
,
...
...
@@ -205,7 +211,7 @@ PetscErrorCode Foam::PetscUtils::foamKSPMonitorFoam
));
}
PetscCall
(
PetscViewerASCIISubtractTab
(
viewer
,
tablevel
));
PetscFunctionReturn
(
0
);
PetscFunctionReturn
(
PETSC_SUCCESS
);
}
...
...
@@ -218,13 +224,13 @@ PetscErrorCode Foam::PetscUtils::foamKSPMonitorRecordInit
)
{
PetscFunctionBeginUser
;
if
(
it
)
PetscFunctionReturn
(
0
);
if
(
it
)
PetscFunctionReturn
(
PETSC_SUCCESS
);
auto
*
ctx
=
static_cast
<
petscLinearSolverContext
*>
(
cctx
);
solverPerformance
&
solverPerf
=
ctx
->
performance
;
solverPerf
.
initialResidual
()
=
rnorm
;
PetscFunctionReturn
(
0
);
PetscFunctionReturn
(
PETSC_SUCCESS
);
}
...
...
@@ -289,7 +295,7 @@ PetscErrorCode Foam::PetscUtils::foamKSPConverge
}
solverPerf
.
finalResidual
()
=
residual
;
PetscFunctionReturn
(
0
);
PetscFunctionReturn
(
PETSC_SUCCESS
);
}
void
Foam
::
PetscUtils
::
setFlag
...
...