|
[Sponsors] |
March 8, 2023, 05:35 |
PETSC4FOAM solve function argument psi.ref
|
#1 |
Senior Member
|
Greetings,
The PETSC4FOAM solve() function calls the scalarSolve() with tpsi.ref() as argument. See L396 of https://develop.openfoam.com/modules.../petscSolver.C . Why is tpsi.ref() used instead of tpsi? What is .ref() of tpsi ? Thx! |
|
March 9, 2023, 05:57 |
|
#2 |
Senior Member
|
I imagine .ref() to return a non-constant reference to tpsi as explained at
Difference between boundaryField() and boundaryFieldRef() Correct? |
|
March 14, 2023, 12:54 |
|
#3 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,695
Rep Power: 40 |
Quote:
Take a look at tmp.H, refPtr.H and PrecisionAdaptor.H for where ref() is being used. In short, you are correct - it is for a modifiable reference to the underlying object. Unlike boundaryFieldRef() however, there is no event counter to track changes. |
||
March 15, 2023, 08:59 |
|
#5 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,695
Rep Power: 40 |
Quote:
They are all located here: https://develop.openfoam.com/Develop...penFOAM/memory |
||
March 20, 2023, 02:28 |
|
#7 |
Senior Member
|
I am trying to overwrite computed values of TEqn.psi() within laplacianFoam (or any other solver). I am struggling with the syntax. To modify the first component of TEqn.psi(), I tried the syntax
Code:
TEqn.psi().ref()[0] = 1.0; Help is appreciated. Last edited by dlahaye; March 20, 2023 at 02:29. Reason: modified |
|
March 20, 2023, 12:50 |
|
#8 |
Senior Member
|
Below for v1906 and v1912
Code:
GeometricField<scalar, fvPatchField, volMesh>& psi = const_cast<GeometricField<scalar, fvPatchField, volMesh>&>(TEqn.psi()); psi.primitiveFieldRef()[0] = 1.0; |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] refineWallLayer Error | Yuby | OpenFOAM Meshing & Mesh Conversion | 2 | November 11, 2021 11:04 |
eigenValues of volTensorField | xuegy | OpenFOAM Programming & Development | 8 | February 26, 2021 16:46 |
OpenFOAM static build on Cray XT5 | asaijo | OpenFOAM Installation | 9 | April 6, 2011 12:21 |
Can anybody help me to solve the list errors while compiling Openfoam 15 on Opensuse 103 32bit | coompressor | OpenFOAM Installation | 0 | November 12, 2008 19:53 |
[blockMesh] Axisymmetrical mesh | Rasmus Gjesing (Gjesing) | OpenFOAM Meshing & Mesh Conversion | 10 | April 2, 2007 14:00 |