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/)
-   -   Cyclic BC for repeating geometries (https://www.cfd-online.com/Forums/openfoam-programming-development/120253-cyclic-bc-repeating-geometries.html)

Yeru July 3, 2013 06:25

Cyclic BC for repeating geometries
 
Hi @ all,

I'm doing my bachelor thesis on a boundary condition for repeating geometries in OpenFOAM.

*** the aim ***
The cyclic boundary condition or anything alike shall be used on repeating geometries, e.g. a helical hollow fibre or a simple pipe. The smallest repeating section shall be used.
Inlet and outlet shall be coupled as: Everything that leaves the geometry at location x+dx and time t1 shall be put back into the geometry at location x and time t2.
In mathematical terms:
u(x1+dx,t1)=u(x1,t2)

The aim is to reconstruct the local data of the n-th (at location x_n) repetition of the geometry by looking at the time data for t_n=x_n/u_0.

For the used geometry, a stationary parabolic profile should be gained after x>6*d.

*** the problem ***
In one sentence, the problem is, that I'm constantly losing energy by mantle friction and the applied cyclic coupling allows no continuous input of energy.


*** General assumptions ***
So far, the general assumptions are:
-monophase (water)
-incompressible fluid
-Re<90 at all times
-simpleFoam as solver
-time-constant flow through inlet (so far, will change in latter process)
and of course
-periodic geometry, of which the smallest repeating section is meshed


*** Mesh ***
I'm running everything on a simple 3D pipe with d=1mm and l=1mm.
It is strictly oriented in direction of positive z.
The mantle is defined with an no slip demand.
The inlet and the outlet are of type cyclic and coupled as neighbourPatches.

Although the orientation of the inlet's and the outlet's face normal vector is antiparallel and checkMesh is fussing about it, the coupling works.

*** initial conditions ***
In order to start a simulation, I chose

Quote:

// 0/U file
type fixedValue;
value uniform (0 0 0.9036);

// 0/p file
type zeroGradient;
for all inlet patches
while the outlet is demanded as

Quote:

// 0/U file
type zeroGradient;

// 0/p file
type fixedValue;
value uniform 0;
*** preCase ***
In order to "fill" the internal field with information, I made a so called preCase.
The mesh is the same, except that inlet and outlet carry the values described above and are _not_ coupled als cyclic neighbour patches.
This geometry is the calculated for 0.1s using simpleFoam as solver.

After gaining this data for the whole field, I start the cyclic case at 0.1s and use mapFields for the 0.1 data.

By using this trick, I overrode the impossibility to demand initial values for patches of the type cyclic.

*** results and problem ***
From the start time 0.1s until the end time 2s, the u profile in z direction is steadily decreasing until it reaches a trivial zero profile.
Physically impossible? Tell me about it ;)

So the wall friction is slowly stealing all the juice.
The upcoming questions are:
How to put it back? homogenously over a certain patch? homogenously over the whole volume?
By using an artificial gravity? How can I define its strength? How can I customize it cell by cell to let it be parallel to the face normal?

Hope, you tasted blood and are eager to help me out.
Thank anyway for reading the whole thing.

jptorol July 25, 2013 17:07

simpleFoam-cyclic BC-continuity
 
Dear Yeru:

1) How did you manage the drop pressure through your pipe? If you are using a cyclic boundary condition for the pressure (inlet/outlet), means that continuity will not be accomplished (you are losing water at every iteration, eventually for your case it seems that you have lost all the water). If such is the case I would recommend you to use a cyclic BBCC for all the other variables, except pressure (ideally use zero gradient for the inlet and a value of 0 for the outlet), although I am not sure how to implement that (due to differences in the patches).

Regards,

JP

ngj July 28, 2013 11:11

Dear Yeru,

Welcome to the forum. What you experience is quite natural, since you do not have a driving force in the domain, which can balance skin friction and form drag from the geometry. If you are using a recent version of OpenFOAM I would suggest that you take a look at the jumpCyclic boundary condition. This conditions allows you to specify a constant pressure loss across the length of the channel.

Kind regards,

Niels

yanxiang December 9, 2013 20:40

Quote:

Originally Posted by ngj (Post 442434)
Dear Yeru,

Welcome to the forum. What you experience is quite natural, since you do not have a driving force in the domain, which can balance skin friction and form drag from the geometry. If you are using a recent version of OpenFOAM I would suggest that you take a look at the jumpCyclic boundary condition. This conditions allows you to specify a constant pressure loss across the length of the channel.

Kind regards,

Niels

Hi Niels,

If possible, could you give more details on the implementation? I didn't seem to find a tutorial case for this type of BC. Also, I am quite curious that in the tutorial case channel1395, the same BC is used but the flow can keep going. So is the boxTurb16. No jumpCyclic BC is imposed.

Thanks,
Yanxiang

Yeru July 3, 2014 09:50

groovyBC did the trick
 
Dear all,
using groovyBC did the trick. There is a very good and applicable tutorial here.

And here is the working p-file:
Code:

    innerRect0_front
    {
    type        groovyBC;
    variables      "p_Rect0back{innerRect0_back}=sum(p*mag(Sf()))/sum(mag(Sf()));p_Rect0front=sum(p*mag(Sf()))/sum(mag(Sf()));f_relax=0.5;";
    valueExpression "(p_Rect0front + f_relax*(p_Rect0back - p_Rect0front))";
    value        $internalField;
    }
    innerRect0_back
    {
        type            zeroGradient;
    }

and the U-file
Code:

    innerRect0_front
    {
    type    zeroGradient;
    }
    innerRect0_back
    {
    type          groovyBC;
    variables      "Q_front{innerRect0_front}=-1*sum(phi);Q_back=sum(phi);f_relax=0.3;";
    valueExpression "(Q_back + f_relax*(Q_front - Q_back))/sum(mag(Sf()))*normal()";
    value        uniform (0 0 0.15);



All times are GMT -4. The time now is 12:39.