CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Custom boundary condition - how to use indices? (https://www.cfd-online.com/Forums/openfoam-programming-development/146112-custom-boundary-condition-how-use-indices.html)

mehdi8619 December 18, 2014 13:09

Custom boundary condition - how to use indices?
 
Hey guys, I'm trying to use indices to define a fixed value boundary conditions but I have no idea how to, check this out:
==========
forAll(*this, i)
{
scalar yy=patch().Cf()[i].component(1);
operator[i]== (n*0);
if (yy < .03)
{
operator[i]= (n*(-0.005));
}
if (yy > .07 )
{
operator[i]= (n*(.005));
}
}
==========
Of course, the use of "[i]" is totally inappropriate. Just wanted to make sure y'all understand what I'm looking for! But I did accomplished a mixed boundary conditions. I basically looking for something like this:
=========
forAll(*this, i)
{
scalar yy=patch().Cf()[i].component(1);
this->refValue()[i]= vector::zero;
this->refGrad()[i] = vector::zero;
this->valueFraction()[i] = 1.0;
if (yy < .03)
{
this->refValue()[i]= n*UUU1;
this->refGrad()[i] = vector::zero;
this->valueFraction()[i] = 1.0;
}
if (yy > .07 )
{
this->refValue()[i]= n*UUU2;
this->refGrad()[i] = vector::zero;
this->valueFraction()[i] = 1.0;
}
}
=========

Thank you for your attention
Mehdi


All times are GMT -4. The time now is 13:27.