Global use of a volScalarField
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 |
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. |
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 |
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 |
All times are GMT -4. The time now is 02:59. |