|
[Sponsors] |
October 10, 2017, 09:27 |
Global use of a volScalarField
|
#1 |
New Member
Argyris Apost
Join Date: Nov 2014
Posts: 7
Rep Power: 12 |
Dear FOAMers,
i created my own volScalarField myField in the creatFields.H: volScalarField myField ( IOobject ( "myField", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, dimensionedScalar("zero",dimensionSet(0,0,0,0,0,0, 0),-1.0), ); and now i want to use it in the smoothSolver.C code as follows: myField.internalField() = ( ...); but the compiler says myField is out of scope. Isnt all Fields supposed to be globaly available? Should i use some include ".H" file ? Best regards, Argyris |
|
October 10, 2017, 20:26 |
|
#2 |
Senior Member
Charles
Join Date: Aug 2016
Location: Vancouver, Canada
Posts: 151
Rep Power: 10 |
Hi Argyris,
smoothSolver can take a scalarField variable (e.g. myField) as an argument and process it. If myField is directly written in the code, it would cause not in problem (not declared in this scope) as myField is not declared in smoothSolver. |
|
October 11, 2017, 09:41 |
|
#3 |
New Member
Argyris Apost
Join Date: Nov 2014
Posts: 7
Rep Power: 12 |
Thank you Charles for your reply.
I went to fvMatrixSolve.C where the smoothSolver is being called and passed the myField as an arguement. However now i have the same "myField was not declared in this scope" problem in the fvMatrixSolve.C and i cant find how to pass myField in the fvMatrixSolve as an arguement as well. Any ideas? Argyris |
|
October 12, 2017, 00:54 |
|
#4 |
Senior Member
Charles
Join Date: Aug 2016
Location: Vancouver, Canada
Posts: 151
Rep Power: 10 |
smoothSolver or fvMatrixSolve is used for solving linear system equation. It is odd that you need a scalar field but I believe you have your reason. I can only think of declaring myField in smoothSolver and read myField in smoothSolver where you need myField, i.e. put your following code inside smoothSolver.
Code:
volScalarField myField ( IOobject ( "myField", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, dimensionedScalar("zero",dimensionSet(0,0,0,0,0,0, 0),-1.0), ); |
|
Tags |
field, global, scope, volscalarfield |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
pimpleDyMFoam computation randomly stops | babapeti | OpenFOAM Running, Solving & CFD | 5 | January 24, 2018 06:28 |
writing execFlowFunctionObjects | immortality | OpenFOAM Post-Processing | 30 | September 15, 2013 07:16 |
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 | bookie56 | OpenFOAM Installation | 8 | August 13, 2011 05:03 |
IcoFoam parallel woes | msrinath80 | OpenFOAM Running, Solving & CFD | 9 | July 22, 2007 03:58 |
Could anybody help me see this error and give help | liugx212 | OpenFOAM Running, Solving & CFD | 3 | January 4, 2006 19:07 |