CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   inlet1 depend on inlet2 (http://www.cfd-online.com/Forums/openfoam/104412-inlet1-depend-inlet2.html)

Tobi July 9, 2012 06:39

inlet1 depend on inlet2
 
Hi all together,

is it possible to make one inlet dependend on the other inlet.
An example:

Total Pressure of Inlet1 and Inlet2 (101325 Pa)...
Outlet Pressure (101300 Pa) ...

Now I wanna have that the mass flow of inlet1 = 0.4 * inlet2
Can I manage that with groovy or sth. like that?

Thx.
Tobi

sylvester July 9, 2012 07:33

Yes, groovyBC will do that for you.

From the average-t-junction example:

Code:

    outlet1   
    {
        type            groovyBC;
        valueExpression "0.5*(pInlet+pOutlet2)";
        variables      "pInlet{inlet}=sum(p*mag(Sf()))/sum(mag(Sf()));pOutlet2{outlet2}=p;";
        value          uniform 100010;
    }


Tobi July 9, 2012 10:25

Hi,

thanks for your replay.
Then my code should look like this:

Code:


inlet1
{
      type                pressureInletVelocity;
      value              $internalField;
}

inlet2
{
      type                groovyBC;
      valueExpression "vector(dependend,0,0)";
      variables          "dependend{inlet}=0.4*mag(U);";
      value              $internalField;
}

Is that correct?

sylvester July 9, 2012 10:43

That's not going to work, for (at least) 3 reasons:

1. Your are referencing inlet instead of inlet1
2. You are using the vector U for the (scalar) component of Ux (use something link U.x instead, see manual)
3. U@inlet1 is a field not a single value, so it is best to calculated its average first (see the example I send before)

regards,
Sylvester

Tobi July 9, 2012 17:46

Oh thx.
Well I had no time to check it. It was my first guess :)
Tomorrow I ll have a look at the BC ...

Thx
Tobi

Tobi July 10, 2012 03:23

Hi Sylvester,

just two questions to you.

1. see manual - you mean the groovy manual? Or which one? Well I think its the only logical thing :)

2. Sf() - is it the flux through a surface like "Sf = Surface flux"?

Thanks in advanced
Tobi

sylvester July 10, 2012 03:35

Quote:

Originally Posted by Tobi (Post 370575)
Hi Sylvester,
1. see manual - you mean the groovy manual? Or which one? Well I think its the only logical thing :)

Yes, 'manual' is a bit confusing. Probably best is to look at the wiki, the examples provided with groovyBC, or the examples posted on this forum.

Quote:

Originally Posted by Tobi (Post 370575)
2. Sf() - is it the flux through a surface like "Sf = Surface flux"?

IIRC Sf() is the cell normal vector with the cell surface area as its magnitude.

Tobi July 10, 2012 04:06

Quote:

Originally Posted by sylvester (Post 370576)
IIRC Sf() is the cell normal vector with the cell surface area as its magnitude.

Oh thanks. I get it now...
Now its working. Thats very nice. Hope that my simulation is more realistic as befor.

Tobi

Tobi July 10, 2012 04:16

Hi Sylvester,

just at least one question.

My BC looks like that:
Code:

    inlet
    {
        type            zeroGradient;
        value          uniform (0 0 0);
    }

    inlet2
    {
        type            groovyBC;
        valueExpression "vector(dependendx,dependendy,dependendz)"
        variables      "dependendx=average(U.x);dependendy=average(U.y);dependendz=average(U.z);";
        value          $internalField;
    }

And both inlets are in the same directory.
Would you say that this BC I made is working correct? Well I have not much confidence. :(


All times are GMT -4. The time now is 14:32.