CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   updating alpha1 inlet from BC (http://www.cfd-online.com/Forums/openfoam-programming-development/87371-updating-alpha1-inlet-bc.html)

pablodecastillo April 18, 2011 18:29

updating alpha1 inlet from BC
 
Hello,

I would like to update the alpha1 in interdyfoam at the inlet meanwhile the mesh move.

I am begining with something simple like this;
word inlet = "xmin";
//if (nameI == inlet) Info <<"/////////////////////// ESTOY EN EL PARCHE ///////////////////////////////// " << nl;
label patchJ;
patchJ=label(mesh.boundaryMesh().findPatchID(inlet ));
if (mesh.Cf().component(2).boundaryMesh()[patchJ] < 0) alpha1=1;


But it is giving me an error like;
error: ‘class Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >’ has no member named ‘boundaryMesh’


advanced thanks

pablodecastillo April 19, 2011 18:06

I made this solution, i guess that it is possible to do it easier, any idea?

word inlet = "xmin";
//if (nameI == inlet) Info <<"/////////////////////// ESTOY EN EL PARCHE ///////////////////////////////// " << nl;
label patchJ;
patchJ=label(mesh.boundaryMesh().findPatchID(inlet ));
const polyPatch& cPatch = mesh.boundaryMesh()[patchJ];
//if (mesh.Cf().component(2).boundaryMesh()[patchJ] < 0) alpha1=1;
vectorField NN = mesh.boundary()[patchJ].Cf();
scalarField inletZ(NN.component(vector::Z));
const pointField& p = mesh.points();
forAll(cPatch, faceI)
{
const labelList& f = cPatch[faceI];
label nPoints = f.size();
//Info << "nada " << p[f[0]] << endl;
scalarList coordZ(4);
coordZ[0] = p[f[0]].component(2);
coordZ[1] = p[f[1]].component(2);
coordZ[2] = p[f[2]].component(2);
coordZ[3] = p[f[3]].component(2);
scalar maxz = coordZ[0];
scalar minz = maxz;
for (int i=1; i<4; i++){
if (coordZ[i] >= maxz) maxz = coordZ[i];
if (coordZ[i] <= minz) minz = coordZ[i];
}
scalar projecZ = maxz-minz;
scalar newalpha=0;
scalar Zpos(inletZ[faceI]);
if (Zpos + 0.5 * projecZ < 0.0) newalpha = 1.0;
else if (Zpos - 0.5 * projecZ > 0.0) newalpha = 0.0;
else newalpha = 0.5 - Zpos / projecZ;
alpha1.boundaryField()[patchJ][faceI] = newalpha;
}



Thanks


All times are GMT -4. The time now is 18:24.