|
[Sponsors] |
How to define a custom value and read an update from the fvSolution file? |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
Senior Member
Klaus
Join Date: Mar 2009
Posts: 287
Rep Power: 23 ![]() |
I am working in some customizations involving the PCG source code. I need to be able to set and update values from the fvSolution file, solvers, p section. The code below includes the relevant code sections. The code compiles fine.
The problem is, that the value from the fvSolution file is not read, the default values are not changeing, when I set a different value in the fvSolution file. How to read a value from fvSolution file, solvers, p section for use within PCG.C? Code:
#include "myPCG.H" #include "PrecisionAdaptor.H" #include "SquareMatrix.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { defineTypeNameAndDebug(myPCG, 0); lduMatrix::solver::addsymMatrixConstructorToTable<myPCG> addmyPCGSymMatrixConstructorToTable_; } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::myPCG::myPCG ( const word& fieldName, const lduMatrix& matrix, const FieldField<Field, scalar>& interfaceBouCoeffs, const FieldField<Field, scalar>& interfaceIntCoeffs, const lduInterfaceFieldPtrsList& interfaces, const dictionary& solverControls ) : lduMatrix::solver ( fieldName, matrix, interfaceBouCoeffs, interfaceIntCoeffs, interfaces, solverControls ), eigenvaluesComputed_(false), // Correct initialization in the initializer list eigRatio_(solverControls.lookupOrDefault<scalar>("eigRatio", 1.5)) // This doesn't read the value from the fvSolution file { // Optional: Print the values for debugging if ((log_ >= 2) || (lduMatrix::debug >= 2)) { Info<< "Eigenvalues Parameters:" << nl << " eigRatio: " << eigRatio_ << nl << endl; } } ... |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Member
Eren
Join Date: Aug 2018
Posts: 92
Rep Power: 9 ![]() |
I'm not sure about the exact procedure but I can suggest you this:
Start from src/OpenFOAM/matrices/solution. You'll see the entries that solver excepts from you. You can define a new entry there and call it in your function maybe. |
|
![]() |
![]() |
![]() |
![]() |
#3 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 821
Rep Power: 16 ![]() |
Here's another suggestion to try. It sounds as if it is not finding the eigRatio dictionary entry ... so maybe it's looking in the wrong place? Try changing the lookupOrDefault to lookup and force an error - it will then hopefully tell you where it's looking.
|
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|