CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Problem with boundary conditions (http://www.cfd-online.com/Forums/openfoam/108128-problem-boundary-conditions.html)

batta31 October 15, 2012 10:52

Problem with boundary conditions
 
Hi to all!
I need to set on a semicircular patch a fixedValue bc. Is it possible, since the bc is related to the patch normals, to set a condition like this?

type fixedValue;
value uniform (patch().nf() & general_vector)*patch().nf()

If it couldn't be possible, is there something similar that I could use?
Thanks
Simone

Bernhard October 15, 2012 11:47

With groovyBC it can be done quite easily (you need to install that as part of swak4Foam)
Code:

    patch
    {
        type            groovyBC;
        value          uniform 0;
        fractionExpression      "1";
        valueExpression      "(normal()^V)&normal()";
    }


batta31 October 16, 2012 09:41

Thanks for the answer Bernhand..up to now it's a bit difficult for me to install a third party program like groovyBC..there isn't a command (such nonuniform) to achieve my aim in another way?

gschaider October 18, 2012 18:36

Quote:

Originally Posted by batta31 (Post 386888)
Thanks for the answer Bernhand..up to now it's a bit difficult for me to install a third party program like groovyBC..there isn't a command (such nonuniform) to achieve my aim in another way?

Well. You can write a utility to set the boundary in the way you want. But if you 're allowed to compile your own programs on your OF-installation then you can install swak/groovyBC as well. Because from the standpoint of the sysadmin there is no difference (you're only compiling a program)

Or you can use the coded-boundary condition

And there is always the possibility to set nonuniform-BCs "by hand" in the text-editot

batta31 October 19, 2012 02:28

Thanks for your advice gschaider
I was trying to set up my own BC such that it takes the normal vectors to the patch and multiplies them to a specific constant vector and this dot product is then multiplied again to the normal vectors to the patch. Its seems to work, I've modified an existing BC..by the way I'd have a question: when I assign the value of this vector to the patch with the operator command, the value of this vector is automatically put on the patch when it's called the function

Ua.correctBoundaryConditions();

right?
And, since it is a constant vector, the same value of the BC is put on the patch at each iteration?

Thanks
Simone

batta31 October 22, 2012 03:09

What I've tried to do is find a similar BC and modify the updateCoeffs() function in this way:

void Foam::adjointVelocityAirfoil::updateCoeffs()
{
if (updated())
{
return;
}

const fvPatchField<vector>& Uap =
patch().lookupPatchField<volVectorField, vector>("Ua");

float alpha = 4*3.14/180;
float a1= cos(alpha);
float a2= sin(alpha);
float a3=0;

vector d(a1, a2, a3);

forAll(patch().faceCells(), i)
{
if(pos(Uap[i] & patch().Sf()[i]))
{
vectorField::operator=((-(d & patch().Sf()[i]))/sqr(patch().magSf()[i])*patch().Sf()[i]);
}
else
vectorField::operator=((d & patch().Sf()[i])/sqr(patch().magSf()[i])*patch().Sf()[i]);
}

}

My aim is to put at each cell of the patch a value of velocity which is given with the scalar product between a constant vector d and the normal to the face, everything projected in the normal direction, and before I make a check on each face to veriry if the scalar product between the quantity Uap and the normal face to the cell is greater than zero or not. Is my code correct or am I making something wrong?

Any suggestion would be very grateful
Thanks
Simone


All times are GMT -4. The time now is 03:45.