CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

updating alpha1 inlet from BC

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   April 18, 2011, 18:29
Default updating alpha1 inlet from BC
  #1
Senior Member
 
Pablo
Join Date: Mar 2009
Posts: 102
Rep Power: 8
pablodecastillo is on a distinguished road
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 is offline   Reply With Quote

Old   April 19, 2011, 18:06
Default
  #2
Senior Member
 
Pablo
Join Date: Mar 2009
Posts: 102
Rep Power: 8
pablodecastillo is on a distinguished road
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
pablodecastillo is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
TimeVaryingMappedFixedValue for Direct Numerical Simulation inlet johndeas OpenFOAM 5 May 21, 2014 07:11
Inlet Velocity in CFX aeroman CFX 12 August 6, 2009 18:42
Inlet table in STAR-CD Sachin CD-adapco 1 March 26, 2008 11:22
updating values at inlet boundaries Stefano CD-adapco 3 March 20, 2007 11:13
what the result is negatif pressure at inlet chong chee nan FLUENT 0 December 29, 2001 06:13


All times are GMT -4. The time now is 16:56.