From 1ac4a0fa6445797cfdcfc450a1b4c632532ed019 Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Mon, 17 Jun 2019 17:51:48 +0100 Subject: [PATCH] COMP: lduMatrix: fix solveScalar compilation --- .../matrices/lduMatrix/lduMatrix/lduMatrix.H | 10 ++++++++++ .../lduMatrix/lduMatrix/lduMatrixSolver.C | 18 ++++++++++++++++++ .../lduMatrix/solvers/GAMG/GAMGSolverSolve.C | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H index 16ea5af785c..3cac582cf30 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H @@ -253,6 +253,7 @@ public: //- Read and reset the solver parameters from the given stream virtual void read(const dictionary&); + //- Solve with given field and rhs virtual solverPerformance solve ( scalarField& psi, @@ -260,6 +261,15 @@ public: const direction cmpt=0 ) const = 0; + //- Solve with given field and rhs (in solveScalar precision). + // Default is to call solve routine + virtual solverPerformance scalarSolve + ( + solveScalarField& psi, + const solveScalarField& source, + const direction cmpt=0 + ) const; + //- Return the matrix norm used to normalise the residual for the //- stopping criterion solveScalarField::cmptType normFactor diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C index 42e24d04b5b..50b6f46bcc8 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C @@ -27,6 +27,7 @@ License #include "lduMatrix.H" #include "diagonalSolver.H" +#include "PrecisionAdaptor.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -170,6 +171,23 @@ void Foam::lduMatrix::solver::read(const dictionary& solverControls) } +Foam::solverPerformance Foam::lduMatrix::solver::scalarSolve +( + solveScalarField& psi, + const solveScalarField& source, + const direction cmpt +) const +{ + PrecisionAdaptor<scalar, solveScalar> tpsi_s(psi); + return solve + ( + tpsi_s.ref(), + ConstPrecisionAdaptor<scalar, solveScalar>(source)(), + cmpt + ); +} + + Foam::solveScalarField::cmptType Foam::lduMatrix::solver::normFactor ( const solveScalarField& psi, diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverSolve.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverSolve.C index 644de4eef9a..d5cbc20296e 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverSolve.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverSolve.C @@ -695,7 +695,7 @@ void Foam::GAMGSolver::solveCoarsestLevel coarsestCorrField = 0; const solverPerformance coarseSolverPerf ( - coarsestSolverPtr_->solve + coarsestSolverPtr_->scalarSolve ( coarsestCorrField, coarsestSource -- GitLab