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/)
-   -   How to determine a boundary type in the code? (http://www.cfd-online.com/Forums/openfoam-programming-development/119254-how-determine-boundary-type-code.html)

cheng1988sjtu June 12, 2013 23:27

How to determine a boundary type in the code?
 
Hi Foamers,

I have a general question about how to determine a boundary type in the code, for example, in twoPhseEulerFoam (OF2.1.0), the pEqn.H has the following code to determine whether the boundary patch is zeroGradient or not:

forAll(p.boundaryField(),patchi)
{
if (isA<zeroGradientFvPatchScalarField>(p.boundaryFie ld()[patchi]))
{
phiDraga.boundaryField()[patchi] = 0.0;
phiDraga.boundaryField()[patchi] = 0.0;
}
}

So, my question is, what if I want to determine whether the boundary field of p is symmetryPlane or not?

I tried the following, and it turns out that it does not work, any hint??
forAll(p.boundaryField(),patchi)
{
if (isA<symmetryPlaneFvPatchScalarField>(p.boundaryFi eld()[patchi]))
{
phiDraga.boundaryField()[patchi] = 0.0;
phiDraga.boundaryField()[patchi] = 0.0;
}
}

Thanks!!!

cheng1988sjtu June 12, 2013 23:39

Further Info
 
forAll(p.boundaryField(),patchi)
{
if (isA<symmetryFvPatchScalarField>(p.boundaryField()[patchi]))
{
phiDraga.boundaryField()[patchi] = 0.0;
phiDragb.boundaryField()[patchi] = 0.0;
}
}

and get the following error message when I tried to compile the code:

error: 'symmetryFvPatchScalarField' was not declared in this scope
error: no matching function for call to 'isA(Foam::fvPatchField<double>&)'

any help?? Thanks!

Charlie

mturcios777 June 13, 2013 12:20

In the basic folder of fvPatchFields in $FOAM_SRC, there is a folder for the basic type basicSymmetry. I think the type you want to test for is basicSymmetryFvPatchScalarField (you'll probably have to do a much more thorough check than I did).

cheng1988sjtu June 13, 2013 12:36

Thanks!
 
Thanks, Marco,

Thank you for you suggestions, the problem is now solved, I need to include "symmetryFvPatchFields.H" in my main files, that's why the error message said,

error: 'symmetryFvPatchScalarField' was not declared in this scope.

Thanks!

Charlie


All times are GMT -4. The time now is 23:04.