CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (http://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   How to input surface value using sample (http://www.cfd-online.com/Forums/openfoam-post-processing/97556-how-input-surface-value-using-sample.html)

nygbook February 20, 2012 10:03

How to input surface value using sample
 
Hello foamers
I use sample to write a surface value that grid is 80*80. So the number of surface value is 6400. However, I discovery the number of surface value is 12800. The sampleDict is below
Code:

surfaceFormat    raw;
interpolationScheme cell;

surfaces
(
    constantPlane
    {
        type            plane;    // always triangulated
        basePoint      (0 0 0);
        normalVector    (0 0 1);

        //- Optional: restrict to a particular zone
        // zone        zone1;
        interpolate    false;
    }
   
);

Anybody can give me some suggestion?

nygbook February 27, 2012 02:22

Done, I have write a small program to resolve the problem. of's iostream is very well

amin144 May 26, 2012 09:11

Quote:

Originally Posted by nygbook (Post 346394)
Done, I have write a small program to resolve the problem. of's iostream is very well

Hi dear Nie
What's the story? what should I do to have same number of points as my grid points?

nygbook June 9, 2012 22:45

Dear amin144, I'm sorry to reply you thread late! The code is show as below
Quote:

#include "fvCFD.H"
#include "OFstream.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{


# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"



IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);

word surfaceScalar_(transportProperties.lookup("surface Scalar"));

volScalarField alpha1
(
IOobject
(
surfaceScalar_,
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh
);

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//----------
OFstream os(runTime.timeName() + ".dat");
Info << "Open the file" << nl;
scalar maxX = 0.0;

forAll(mesh.C(), celli)
{
vector c = mesh.C()[celli];
if(c.x() >= maxX)
maxX = c.x();
}


forAll(mesh.C(), celli)
{

vector c = mesh.C()[celli];
os << c.x() << ' ' << c.y() << ' ' << c.z() << ' ' << alpha1[celli] << nl;
if(c.x() >= (maxX - 0.001))
os << nl;
}



Info << "\n write file is complete \n";

return 0;
}


// ************************************************** *********************** //
I hope it can help you


All times are GMT -4. The time now is 06:19.