CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Slip boundary around circles (https://www.cfd-online.com/Forums/openfoam-solving/58485-slip-boundary-around-circles.html)

 zhoubinwx July 29, 2008 06:50

Dear all, My simple 2-D incom

Dear all,
My simple 2-D incompressible case: in a rectangle, there are three circles(randomly), and the flow is around these circles.

Now let us suppose this kind of slip boundary:
Ux(yc - y)^2= &part;Ux/&part;x*d
where Ux means the x-component of the velocity U at the circle surface(x,y);
yc means the y-coordinate of the circle center;
d means the circle diamter;

Would you please kindly give me some suggestion the method of setting this kind of "slip"? Because I do not know how to get the grid coordinates around the circle, the circle center coordinates, the diameter, and ux, as well as &part;Ux/&part;x.

I do now know how could I apply my supposed boundary.

I looked at the userguide, to find that there is slip and partial slip boundaries, depending on the slip valueFraction. Is anyone who know which file is used for this setting?

Bin

 ngj July 29, 2008 07:17

Hi Bin Suppose that all of

Hi Bin

Suppose that all of the circles have the same boundary patch name. Then you can get your values as follows:

label patchID = mesh.boundaryMesh().findPatchID("patchName");

const vectorField &bcFaces = mesh.Cf().boundaryField()[patchID]; // Face centres on the circles
const vectorField &bcU = U.boundaryField()[patchID]; // Velocities on the circles

I am not able to help you on the diameter/centre. But I believe you would be able to retrieve such information based on simple geometrical considerations.

Best regards,

Niels

 zhoubinwx July 29, 2008 08:32

Hi Niels, Thank you for you

Hi Niels,

Thank you for your suggestion, I am working on it and I'll post it here.

Best regards,

Bin

 zhoubinwx August 2, 2008 11:30

Hi, in order to know the step

Hi, in order to know the step to implement simple boundary condition on models, I use ramped boundary condition, on the base of the boundary "oscillatingFixedValue".

However, when I wmake, I get the error:
Making dependency list for source file icoFoamRamped.C
could not open file rampedFixedValueFVPatchFiedls.H for source file icoFoamRamped.C
make: *** No rule to make target `rampedFixedValueFvPatchFields.dep', needed by `Make/linuxGccDPOpt/dependencies'. Stop.

I do not know how could I solve this problem. Is here anyone who could get me out?

Thank you

 zhoubinwx August 7, 2008 04:54

Hi, the above problem is solve

Hi, the above problem is solved.

Now when I do as follows:
--------------------------
cp -r \$FOAM_TUTORIALS/icoFoam/cavity ~/OpenFOAM/zhou-1.5/applications/icoFoamRamped/cavityRamped
cd cavityRamped/
cd 0
gedit U &
--------------------------
movingWall
{
type rampedFixValue
refValueLow (0 0 0);
refValueHigh (10 0 0);
startRamp 0.1;
endRamp 0.4;
}
--------------------------
I have changed the movingwall boundary with our modified ramped boundary, then
icoFoamRamped> log &
I get error:
----------------------------
Cannot find 'value' entry on patch movingWall of field U in file "/home/zhou/OpenFOAM/zhou-1.5/applications/icoFoamRamped/cavityRamped/0/U"
which is required to set the values of the generic patch field.
(Actual type rampedFixValue)

Please add the 'value' entry to the write function of the user-defined boundary-condition
or link the boundary-condition into libfoamUtil.so

file: /home/zhou/OpenFOAM/zhou-1.5/applications/icoFoamRamped/cavityRamped/0/U::moving Wall from line 37 to line 41.

From function genericFvPatchField::genericFvPatchField(const fvPatch&, const Field&, const dictionary&)
in file fields/fvPatchFields/basic/generic/genericFvPatchField.C at line 72.

FOAM exiting
--------------------------

I go deep into the file "rampedFixedValueFvPatchField.C", and could not find anything wrong.

Thank you.

Best regards,

Bin

 ngj August 7, 2008 06:14

Hi Zhoubin The way it is do

Hi Zhoubin

The way it is done, you need to give an initial value for the patch. Thus you need to add

value uniform (0 0 0);

to you /0/U file in the given patch. This value field should be overwritten in the very first time step.

Of course you can choose any other initial fieldhttp://www.cfd-online.com/OpenFOAM_D...part/happy.gif

Good luck,

Niels

 zhoubinwx August 7, 2008 08:34

Hi Niels, So glad to hear f

Hi Niels,

So glad to hear from you again. You are very kind.

I have followed your suggestion, but get the same error.

Therefore I would like to attach the source file here, it is located in the directory: \$FOAM_USER_DIR/applications

/attach{icoFoamRamped}

Could I ask you for a look when you are free?

Thank you.

Best regards,

Bin

 zhoubinwx August 7, 2008 08:35

The file is:

The file is:

 zhoubinwx August 7, 2008 08:42

Hi Niels, The maximum of th

Hi Niels,

The maximum of the attached file should be 50 kb, therefore I have send the file to your email.

Thank you.

Bin

 zhoubinwx August 9, 2008 11:22

Dear all, One friend of mine

Dear all,
One friend of mine helps to use a different way to implement the ramped velocity boundary, which will be used for the movingWall patch of cavity case. However, even though it runs ok, when paraFoam is performed, it stops suddenly and says:
----------------------------
--> FOAM Warning :
From function dlLibraryTable::open(const fileName& functionLibName)
in file db/dlLibraryTable/dlLibraryTable.C at line 79
could not load /home/zhou/OpenFOAM/zhou-1.5/lib/linuxGccDPOpt/libmyBCs.so: undefined symbol: _ZTIN4Foam5token8compoundE

Cannot find 'value' entry on patch movingWall of field U in file "/home/zhou/OpenFOAM/zhou-1.5/applications/icoFoamRamped/cavityRamped/0/U"
which is required to set the values of the generic patch field.
(Actual type rampedFixedValue)

Please add the 'value' entry to the write function of the user-defined boundary-condition
or link the boundary-condition into libfoamUtil.so

file: /home/zhou/OpenFOAM/zhou-1.5/applications/icoFoamRamped/cavityRamped/0/U::moving Wall from line 25 to line 28.

From function genericFvPatchField<type>::genericFvPatchField(con st fvPatch&, const Field<type>&, const dictionary&)
in file fields/fvPatchFields/basic/generic/genericFvPatchField.C at line 72.

FOAM exiting
----------------------------

I need your suggestion if you know how to deal with this.

Many thanks.

Bin

 zhoubinwx August 12, 2008 05:16

Dear all, the above problem

Dear all,
the above problem is solved with the command "foamToVTK", and use paraFoam to open it.

But now my friend, he tries to simulate and it is so strange that he gets the error when he runs the case cavity:

The error:
Cannot find 'value' entry on patch movingWall of field U in file "/home/zhou/OpenFOAM/zhou-1.5/applications/icoFoamRamped/cavityRamped/0/U"
which is required to set the values of the generic patch field.
(Actual type rampedFixedValue)

Please add the 'value' entry to the write function of the user-defined boundary-condition
or link the boundary-condition into libfoamUtil.so

file: /home/zhou/OpenFOAM/zhou-1.5/applications/icoFoamRamped/cavityRamped/0/U::moving Wall from line 25 to line 28.

From function genericFvPatchField<type>::genericFvPatchField(con st fvPatch&, const Field<type>&, const dictionary&)
in file fields/fvPatchFields/basic/generic/genericFvPatchField.C at line 72.
------------------

If anyone knows the reason, would you please tell us.

Thanks a lot.

Best regards,

Bin

 zhoubinwx August 12, 2008 05:29

Hi, this is the content of ram

Hi, this is the content of rampedFixedValueFvPatchField. C:
-------------------
if (dict.found("value"))
{
fixedValueFvPatchField<type>::operator==
(
Field<type>("value", dict, p.size())
);
}
else
{
fixedValueFvPatchField<type>::operator==
(
refValueLow_ + (refValueHigh_ - refValueLow_)*currentScale()
)
}
______________
this means if we specify a new boundary "rampedFixedValue", the computer will use my equation.

But why I still have the above problems, I am really puzzled.

Bin

 ngj August 12, 2008 17:17

Hi Bin I have been wonderin

Hi Bin

I have been wondering about one detail. The error message seem to suggest that the actual value on the boundary patch is missing. It should be said that I am still using 1.4.1.

As I suggested above, you should add
value uniform (0 0 0);
in the /0/U file. As you reported this didn't change anything. Though somehow the error message points in that direction and I am wondering that since you have tried and succeeded with this new implementation (your friends), are things in this version actually written to the output files, or does the values at the boundary patch in the <time>/U not change?
If that's the case, there is something wrong in the ::write() in your BC.

I am sorry that I cannot be more specific. Hope you succeed.

Best regards,

Niels

 zhoubinwx August 22, 2008 05:57

Hi Niels, The ramped veloci

Hi Niels,

The ramped velocity boundary problem is solved when I use "timeVaryingUniformFixedValue".

My purpose to try this simple boundary is to implement our "slip" boundary.

Model studied:in a rectangle, there are three circles(randomly, I set them as a patch "circle"), and the flow is around these circles.

Now let us suppose this kind of partialslip boundary:
Ux(yc - y)^2= partial(Ux)/partial(x)*d
where Ux means the x-component of thpartial(Ux)/partial(x)e velocity U at the circle surface(x,y);
yc means the y-coordinate of the circle center;
d means the circle diamter;

Until now I know that:
(1)x
label patchID = mesh.boundaryMesh().findPatchID("circle");
U.mesh().boundary()[patchID].x()

(2)Xc
use three points-->circle center program,

If I have the id of the patch, you get only the cells around the circle. To find the diameter and center, just loop over the patch and find at least three point mesh.C.
--------------------------------------------
first of all, we need to provide the three points around the circle

label patchID = mesh.boundaryMesh().findPatchID("circle");
volVectorField point1=U.mesh().boundary()[patchID].[0]; ////?????Is this right, I hope this stands for one vertice around the cicle
volVectorField point2=U.mesh().boundary()[patchID].[1];
volVectorField point3=U.mesh().boundary()[patchID].[2]; // three vectors;

-----------------------------------
Next we calculate the center of thoese circles:

#include
#include
#include
using namespace std;

int main()
{
int x1,y1,x3,y3;//x1=point1.x(); y1=point1.y();
double a,b,c,d,e,f;
double r,k1,k2,x,y,x2,y2;
if((y1==y2)&&(y2==y3))
{
cout<<"The three points can not form a circle!"<circle center program? Be careful the center is not (0,0,0)!!!
);

Info << "Cylinder diameter = " << diameter.value() << " m" << endl;

(4) Ux:
label patchID = mesh.boundaryMesh().findPatchID("circle");
const vectorField &bcU = U.boundaryField()[patchID]; // Velocities on the circles
then
Ux could be expressed by "bcU.component(vector::X)" or "bcU.component(0)";
or "bcU.x()"
(5) partial(Ux)/partial(x) could be expressed by "grad(bcU.component(vector::X)).component(0)".
//suppose scalar could have gradient, like p;

Could you and other friends give me any suggestion to include this boundary?

Many thanks.

Bin

 zhoubinwx September 1, 2008 09:07

Dear all, I am thinking abo

Dear all,

I am thinking about if I should use the short form or the concise form to define my "slip" boundary.

The concise form is:
U ∙ n = 0
U ∙ t = [Kn/(1+Kn)] n ∙ (U ∙ t)

For the second equation, I write:
----------------------------
label circlePatchID=Mesh().boundary().findPatchID("circl e");
const surfaceVectorField & n=mesh.boundary()[circlePatchID].Cf();
volVectorField U_t=U-n*(n & U); //the tangential component of velocity vector U

solve
(
U_t
)
----------------------------

Could anyone give me any help for implementing this if the code is right?

Thank you very much.

Bin

 ngj September 4, 2008 04:07

Hi Bin Been hung up at work

Hi Bin

Been hung up at work, but I have some comments:

1) You say, that you name all the circles with the same patch name. If your are not extremely careful, then you will not be able to know which boundary faces belongs to which circles, and the results you get in diameter/centre will be erroneous. Thus I suggest you use three different names.

2) In your previous post I assume n is your normal? The normal is obtained using mesh.boundary()[circlePatchID].Sf() / mesh.boundary()[circlePatchID].magSf();
where the last part divides by the magnitude of the normal vector.

3)I am not complete sure what it is you mean by this partial slip condition, and my browser doesn't like some of your characters, so could you please come up with a sketch?

Best regards,

Niels

 zhoubinwx September 4, 2008 10:32

Hi Niels, Glad to hear from

Hi Niels,

1) I name all the circles as a patch "circle". At first I think I use "forAll" to loop. Here I accept your suggestions, i.e. using different names. By the way, dear Niels, I have 100 circles in my rectangle. how should I name them?

2) In the previous post, n is the unit normal vector. As you wrote, "mesh.boundary()[circlePatchID].Sf() / mesh.boundary()[circlePatchID].magSf();" is the unit normal verctor
The meaning of "U ∙ n = 0 " is that the normal velocity around the circle is 0.

3) Sorry for the characters, would you please check the programmersGuide section 2.1.1, the missing character is the gradient.

Since I have derived the equations, would you please help a little bit, to use them instead of the slip/ partial slip condition existing in OpenFOAM.

Best regards,

Bin

 zhoubinwx September 8, 2008 04:05

I will investigate this by mys

I will investigate this by myself, stop complaining. I will share with you the code after I finish this part. You could email me if you want: zhoubinwx at hotmail.com

 zhoubinwx September 11, 2008 03:32

Dear all, For the first que

Dear all,

For the first question:
1) I name all the circles as a patch "circle". At first I think I use "forAll" to loop. Here I accept your suggestions, i.e. using different names. By the way, dear Niels, I have 100 circles in my rectangle. how should I name them?

I have solved using Gmsh.

I am working on the second and third problems I have.

 ngj September 12, 2008 08:39

Hi Bin I have made a small

Hi Bin

I have made a small quick solution, which just require of you to copy-paste into your /0/U file.

### FROM HERE ------------------------

#!/bin/sh
s=1

while [ \$s -lt 100 ]
do
printf " circle%s\n" \$s
printf " {\n"
printf "\ttype\tslip;\n"
printf " }\n\n"
s="\$(expr "\$s" '+' '1')"
done

### TO HERE --------------------------

Put is in a empty file and execute it as

sh <filename> > tempToPasteTo_0_U

Have a nice weekend

All times are GMT -4. The time now is 21:43.