CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (http://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   volScalarField Issue (http://www.cfd-online.com/Forums/openfoam-pre-processing/115004-volscalarfield-issue.html)

otq March 21, 2013 11:03

volScalarField Issue
 
I am modifying the chtmultiregionfoam solver and need to reference the temperature field to setup my density. My createfluidfields.H file looks like this

forAll(fluidRegions, i)
{
Info<< "Reading field T\n" << endl;
TFluid.set
(
i,
new volScalarField
(
IOobject
(
"T",
runTime.timeName(),
fluidRegions[i],
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
fluidRegions[i]
)
);


Info<< " Adding to pFluid\n" << endl;
pFluid.set
(
i,
new volScalarField
(
IOobject
(
"p",
runTime.timeName(),
fluidRegions[i],
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
fluidRegions[i]
)
);

Info<< " Adding to rhoFluid\n" << endl;
if (TFluid[i].value()< 644)
{
double a[i]=-0.00022293*pow(TFluid[i],3)+1.9731e-09*pow(TFluid[i],2)*pFluid[i]+0.33433*pow(TFluid[i],2)-7.5161e-15*TFluid[i]*pow(pFluid[i],2)-1.9062e-06*TFluid[i]*pFluid[i]-169.5286*TFluid[i]+2.2902e-20*pow(pFluid[i],3)+2.6378e-12*pow(pFluid[i],2)+0.0004861378*pFluid[i]+29695.2331;
}
else if (TFluid[i] > 650)
{
double a[i]=-0.0057583*pow(TFluid[i],3)+1.6699e-09*pow(TFluid[i],2)*pFluid[i]+11.8606*pow(TFluid[i],2)+1.6565e-13*TFluid[i]*pow(pFluid[i],2)-1.1593e-05*TFluid[i]*pFluid[i]-8014.6607*TFluid[i]-2.3615e-20*pow(pFluid[i],3)-1.1073e-10*pow(pFluid[i],2)+.0070842*pFluid[i]+1776203.1923;
}
else
{
double a[i]=(-0.00022293*pow(TFluid[i],3)+1.9731e-09*pow(TFluid[i],2)*pFluid[i]+0.33433*pow(TFluid[i],2)-7.5161e-15*TFluid[i]*pow(pFluid[i],2)-1.9062e-06*T[i]*pFluid[i]-169.5286*TFluid[i]+2.2902e-20*pow(pFluid[i],3)+2.6378e-12*pow(pFluid[i],2)+0.0004861378*pFluid[i]+29695.2331)*(TFluid[i]-644)/6+(-0.0057583*pow(TFluid[i],3)+1.6699e-09*pow(TFluid[i],2)*pFluid[i]+11.8606*pow(TFluid[i],2)+1.6565e-13*TFluid[i]*pow(pFluid[i],2)-1.1593e-05*TFluid[i]*pFluid[i]-8014.6607*TFluid[i]-2.3615e-20*pow(pFluid[i],3)-1.1073e-10*pow(pFluid[i],2)+.0070842*pFluid[i]+1776203.1923)*(650-TFluid[i])/6;
}

rhoFluid.set
(
i,
new volScalarField
(
IOobject
(
"rho",
runTime.timeName(),
fluidRegions[i],
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
a[i]
)
);

When I wmake all I receive the following error
fluid/createFluidFields.H: In function ‘int main(int, char**)’:
fluid/createFluidFields.H:69:31: error: ‘struct Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>’ has no member named ‘value’

I am unclear as to how to properly call it so that for each cell within each region I take out the temperature value of that cell, then determine which of the three polynomials to use. Finally getting a density value for that cell based on that cell's temperature and pressure. Any help would be greatly appreciated.


All times are GMT -4. The time now is 07:38.