CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Mesh Utilities (http://www.cfd-online.com/Forums/openfoam-meshing-utilities/)
-   -   Selecting cellzone using cellSet in OpenFOAM-1.7.0 (http://www.cfd-online.com/Forums/openfoam-meshing-utilities/100407-selecting-cellzone-using-cellset-openfoam-1-7-0-a.html)

ggoggodak85 April 25, 2012 05:48

Selecting cellzone using cellSet in OpenFOAM-1.7.0
 
Dear all,

I'm trying to calculate coriolis force.
I've already made the mesh in constant dir.

There are two cellzones, cellTable_1(fluid region), cellTable_2(fluid region with rotating)

How can I calculate the Radius for only cellTable_2?
running following code, the coriolis force is calculated in every cells.

I guess just modifying mesh.C() to mesh in cellTable_2 in volVectorField Radius.

can anyone help on this issue? Give me a great idea for solving :)

Thank you all.


================================================== =============
Here is the my code.

#include "fvCFD.H"

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

int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"

forAll(mesh.cellZones(), i)
{
const cellZone& zone = mesh.cellZones()[i];

if (zone.name()=="cellTable_2")
{
const labelList& cellLabels = mesh.cellZones()[i];

Info << "Found matching zone " << zone.name() << " with " << cellLabels.size() << " cells." << endl;

dimensionedVector Omega
(
"Omega",
dimensionSet(0, 0, -1, 0, 0, 0, 0),
//RPM 10 rad/s
vector(0, 10, 0)
);

// Define centor of rotating frame
dimensionedVector Origin
(
"Origin",
dimensionSet(0, 1, 0, 0, 0, 0, 0),
point(0.0, 0.0, 0.0)
);

volVectorField Radius = (mesh.C() - Origin);

// Calculate the coriolis force in entire cells
volVectorField Fcoriolis
IOobject
(
"Fcoriolis",
runTime.timeName(),
mesh
),
Omega ^ Radius
);
Fcoriolis.write();
}
}
return 0;
}


All times are GMT -4. The time now is 04:34.