CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   writing volScalarField (https://www.cfd-online.com/Forums/openfoam-post-processing/79203-writing-volscalarfield.html)

ubaid August 16, 2010 13:55

writing volScalarField
 
Hello everybody,

I am stucked to a simple problem and not able to find out a solution of it.

I want to read gradient from another file and interested to write it into T (temperature file of OpenFOAM).

I did like as below:

volScalarfield field
(
IOobject(fieldName,runtTime.timeName(),mesh,IOobje ct::NO_READ,IOobject::AUTO_WRITE),
mesh,
dimensionedScalar(fieldName,dimTemperature, 200),
"fixedGradient"
);
forAll(field.BoundaryField(),patchID)
{
field.boundaryField()[patchID]==30;
}

As an output of this code am getting something different.
that is.

boundaryField
{
Inlet
{
type fixedGradient;
gradient uniform 0;
}

and so on;
}

but I am interested to get output as below:

boundaryField
{
inlet
{
type fixedGradient;
gradient uniform 30;

}
}

I am sure am doing a mistake, and I think by using field.boundaryField()[patchID]==30; temperature at the patchID is getting stored, instead of temperature value, am interested to store gradient value.

I shall be thankful for your kind replies.

BEst Regards,


All times are GMT -4. The time now is 23:41.