|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
Argyris Apost
Join Date: Nov 2014
Posts: 7
Rep Power: 10 ![]() |
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 |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Charles
Join Date: Aug 2016
Location: Vancouver, Canada
Posts: 139
Rep Power: 8 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
Argyris Apost
Join Date: Nov 2014
Posts: 7
Rep Power: 10 ![]() |
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 |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
Charles
Join Date: Aug 2016
Location: Vancouver, Canada
Posts: 139
Rep Power: 8 ![]() |
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
pimpleDyMFoam computation randomly stops | babapeti | OpenFOAM Running, Solving & CFD | 5 | January 24, 2018 05:28 |
writing execFlowFunctionObjects | immortality | OpenFOAM Post-Processing | 30 | September 15, 2013 06:16 |
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 | bookie56 | OpenFOAM Installation | 8 | August 13, 2011 04:03 |
IcoFoam parallel woes | msrinath80 | OpenFOAM Running, Solving & CFD | 9 | July 22, 2007 02:58 |
Could anybody help me see this error and give help | liugx212 | OpenFOAM Running, Solving & CFD | 3 | January 4, 2006 18:07 |