October 13, 2021, 11:49
|
codedFixedValue not assigning values to the inlet
|
#1
|
New Member
Join Date: Jul 2021
Posts: 16
Rep Power: 5
|
Hello,
I'm new to OpenFOAM and trying to simulate a flow in a channel to learn OpenFOAM. I'm running multiphase (water and air) case so I would like to assign flowrate where alpha.water is 1 (which is z<=0.8 in my case. I used the following code in my 0/U file but nothing is happening to the model. Can someone who has experience with codedFixedValue chime in on this? I would appreciate the help. Thanks.
Here in the inlet BC from 0/U file
Code:
inlet
{
type codedFixedValue;
value uniform (0 0 0);
name inletBC;
code
#{
const fvPatch& boundaryPatch = patch();
const vectorField& Cf = boundaryPatch.Cf();
vectorField& field = *this;
forAll (Cf, faceI) // loop over all the patch faces
{
const scalar x = Cf[faceI].x(); // y coordinate of the face
const scalar y = Cf[faceI].y(); // y coordinate of the face
const scalar z = Cf[faceI].z(); // y coordinate of the face
if (z <= 0.80 && y <= 2 && x <=0.1 )
{
field[faceI] = vector(1, 0, 0);
}
else
{
field[faceI] = vector (0, 0, 0);
}
}
#};
}
|
|
|