Difference between revisions of "Sig Turbomachinery / Tutorials"
m (→Cylindrical Coordinate Systems) |
m (→Cylindrical Coordinate Systems) |
||
Line 20: | Line 20: | ||
//Find the Cartesian positions at the patch | //Find the Cartesian positions at the patch | ||
− | |||
const fvPatchVectorField& cartFaceCentres = mesh.Cf().boundaryField()[inletPatchID]; | const fvPatchVectorField& cartFaceCentres = mesh.Cf().boundaryField()[inletPatchID]; | ||
//Put the results in U at the patch so that you can visualize the result | //Put the results in U at the patch so that you can visualize the result | ||
− | |||
fvPatchVectorField& CCSin = U.boundaryField()[inletPatchID]; | fvPatchVectorField& CCSin = U.boundaryField()[inletPatchID]; | ||
//Define your cylindrical coordinate system | //Define your cylindrical coordinate system | ||
− | |||
cylindricalCS ccs | cylindricalCS ccs | ||
− | |||
( | ( | ||
− | |||
"ccs", | "ccs", | ||
− | |||
vector(0, 0, 0), //center point of ccs | vector(0, 0, 0), //center point of ccs | ||
− | |||
vector(0, 0, 1), //axis of ccs | vector(0, 0, 1), //axis of ccs | ||
− | |||
vector(1, 1, 0) //base axis for cylindrical angle | vector(1, 1, 0) //base axis for cylindrical angle | ||
− | |||
); | ); | ||
//It doesn't seem to be possible to do the whole field at once, so | //It doesn't seem to be possible to do the whole field at once, so | ||
− | |||
//loop through all the patch faces and set the radial, tangential and | //loop through all the patch faces and set the radial, tangential and | ||
− | |||
//axial position | //axial position | ||
forAll(CCSin, facei) | forAll(CCSin, facei) | ||
− | |||
{ | { | ||
− | |||
CCSin[facei] = ccs.toLocal(cartFaceCentres[facei]); | CCSin[facei] = ccs.toLocal(cartFaceCentres[facei]); | ||
− | |||
//Make sure that you have only positive angles and that the | //Make sure that you have only positive angles and that the | ||
− | |||
//angle is zero at the base axis: | //angle is zero at the base axis: | ||
− | |||
CCSin[facei][1] = CCSin[facei][1] + neg(CCSin[facei][1])*360; | CCSin[facei][1] = CCSin[facei][1] + neg(CCSin[facei][1])*360; | ||
− | |||
} | } | ||
Revision as of 14:22, 25 June 2007
Here you can add turbomachinery tutorials to the standard distribution, or to the turbomachinery developments of OpenFOAM.
Whenever possible, the tutorials should be included in the basic structure of theOpenFOAM Wiki, and here you can add links to those tutorials that are of interest to the turbomachinery field.
1 Solvers
Like the standard distribution
2 Utilities
Like the standard distribution
3 Libraries
Things that can be linked against an application or used as plugins to existing applications
3.1 Cylindrical Coordinate Systems
The example requires that you have a mesh and a velocity field U, and that you have defined inletPatchID. You also need to do #include "cylindricalCS.H". If your base code writes out the velocity field U you can then visualize the radial, tangential and axial coordinates as U at the inlet patch using for instance paraFoam. The example was developed for OF1.3.
//Test of cylindricalCS //Find the Cartesian positions at the patch const fvPatchVectorField& cartFaceCentres = mesh.Cf().boundaryField()[inletPatchID]; //Put the results in U at the patch so that you can visualize the result fvPatchVectorField& CCSin = U.boundaryField()[inletPatchID]; //Define your cylindrical coordinate system cylindricalCS ccs ( "ccs", vector(0, 0, 0), //center point of ccs vector(0, 0, 1), //axis of ccs vector(1, 1, 0) //base axis for cylindrical angle ); //It doesn't seem to be possible to do the whole field at once, so //loop through all the patch faces and set the radial, tangential and //axial position forAll(CCSin, facei) { CCSin[facei] = ccs.toLocal(cartFaceCentres[facei]); //Make sure that you have only positive angles and that the //angle is zero at the base axis: CCSin[facei][1] = CCSin[facei][1] + neg(CCSin[facei][1])*360; } //You can also look at a single cylindrical component, here radial: Info << "ccs.toLocal(cartFaceCentres[0]).component(vector::X)" << endl; Info << ccs.toLocal(cartFaceCentres[0]).component(vector::X) << endl;
4 Other
Things that don't fit any of the above categories: shell scripts that help to use OpenFOAM, language bindings, plugins to third party software that enables it to interact with OpenFAOM ...