CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   time varying vector boundary condition using patch normal (https://www.cfd-online.com/Forums/openfoam-solving/95799-time-varying-vector-boundary-condition-using-patch-normal.html)

mpeti January 3, 2012 10:24

time varying vector boundary condition using patch normal
 
Dear forum members,

I would like to specify time varying inlet velocity boundary conditions over the inlet of a pipe. For this purpose I can use the built in timeVaryingUniformFixedValue plus a data file with (timestamp, vector) pairs.

As the inlet velocities are assumed to be coaxial with the inlet patch surface normal, having scalar values instead of vectors in the data file would make things a lot easier (there are multiple datasets with different inlet orientations, but the inlet patch is always properly oriented).

As far as I know the BC type surfaceNormalFixedValue creates vector BCs from a single scalar input (using the patch normal), I believe this is the behavior I would need using time varying scalars. My question is if there is such a BC type already available, or are other alternative solutions to this problem?

Thanks a lot,
Peter

gschaider January 3, 2012 17:10

Quote:

Originally Posted by mpeti (Post 337684)
Dear forum members,

I would like to specify time varying inlet velocity boundary conditions over the inlet of a pipe. For this purpose I can use the built in timeVaryingUniformFixedValue plus a data file with (timestamp, vector) pairs.

As the inlet velocities are assumed to be coaxial with the inlet patch surface normal, having scalar values instead of vectors in the data file would make things a lot easier (there are multiple datasets with different inlet orientations, but the inlet patch is always properly oriented).

As far as I know the BC type surfaceNormalFixedValue creates vector BCs from a single scalar input (using the patch normal), I believe this is the behavior I would need using time varying scalars. My question is if there is such a BC type already available, or are other alternative solutions to this problem?

Thanks a lot,
Peter

As anyone can tell you my first answer to such a question would be "use the groovyBC in swak4Foam". But since 2.1 there is also another option: flowRateInletVelocity now supports DataEntries which allows the specification of time varying data from data files (check the release notes: maybe surfaceNormalFixed is among the supported BCs then you won't have to recalculate your data to give the flowRate)

If you go for groovyBC then something like
Code:

   
    type groovyBC;
    timelines (
        {
            name inVel;
            outOfBounds clamp;
            fileName "$FOAM_CASE/inVel.data";
        }
    );
    valueExpression "-inVel*normal()";

should do the trick

philippose January 4, 2012 01:21

Hi there,

A Good day to you (And ofcourse, a Happy New Year too :-)!)...

As Bernhard mentioned, groovyBC is a great option for such "out of the normal" boundary conditions.

However, there is yet another option in OpenFOAM itself.... I dont know if this is a feature specific to the OpenFOAM-ext versions, but look for the following:

timeVaryingFlowRateInletVelocity

This gives you exactly what you wanted.... a data-file based scalar input into a patch which is internally converted into a velocity vector normal to the patch faces.

You can usually find all the available boundary conditions at the following location in case you have access to it....:

"[OpenFOAM source]/src/finiteVolume/fields/fvPatchFields/derived/"


Have a great day ahead!

Philippose

mpeti January 4, 2012 05:25

Quote:

Originally Posted by philippose (Post 337777)
Hi there,

A Good day to you (And ofcourse, a Happy New Year too :-)!)...

As Bernhard mentioned, groovyBC is a great option for such "out of the normal" boundary conditions.

However, there is yet another option in OpenFOAM itself.... I dont know if this is a feature specific to the OpenFOAM-ext versions, but look for the following:

timeVaryingFlowRateInletVelocity

This gives you exactly what you wanted.... a data-file based scalar input into a patch which is internally converted into a velocity vector normal to the patch faces.

You can usually find all the available boundary conditions at the following location in case you have access to it....:

"[OpenFOAM source]/src/finiteVolume/fields/fvPatchFields/derived/"


Have a great day ahead!

Philippose

Thanks a lot, timeVaryingFlowRateInletVelocity is part of the basic openFOAM version (1.7.1) I am currently using.

Due to the complexities of the BC derivation hierarchy could you please clarify how the argument "flowRate" influences the final BC values? You are supposed to set flowRate a scalar value, and provide a file with entries relating timestamps to scalar values representing the flow rate. Is the final flow rate computed as the product of flowRate and the entries in the file?

Thanks a lot,
Peter

philippose January 4, 2012 05:36

Hello Peter,

The "flowRate" entry in the boundary condition is only a placeholder, and is not used in the calculation of the boundary condition values.

I always set this value to "0".

The entry has to be present in the BC, because this BC is derived from the "flowRateInletVelocity" boundary condition, where the "flowRate" entry actually defines the fixed flow rate at that patch.... in the case of "timeVaryingFlowRateInletVelocity", this value is not used.

The values that you provide in the data file has to be of the format:

Code:

(
(time1  flow1)
(time2  flow2)
..
..
..
(timeN  flowN)
)

a typical ramp input would be:

Code:

(
(0  0)
(500 0.001)
(5000 0.001)
)

The above data file with result in the flowRate varying linearly from 0 to 0.001 in the first 500 iterations (in the case of steady state solvers), and will remain constant at 0.001 for the rest of the iterations.


The value of flowRate itself is internally converted into a velocity vector at the patch whose magnitude is "flowRate/(Patch Area)" and whose direction will be normal to each face of the patch.


Hope this helps?

Philippose

robingilbert January 23, 2012 16:43

Hi Phillipose,

Is it not possible to ramp down the values using timelines? i tried giving:

(
(90 0)
(92 10000)
(95 1000)
(100 100)
(105 0)
)

for

Code:

hotwall   
{
type        groovyBC;
value        uniform 291;
valueExpression "291";
gradientExpression "gradT";
fractionExpression "0";
variables      "heatFlux=10000;Cp0=1004;rho0=1.292;        alphaEff=pow(10,-4);gradT=heatFlux/(alphaEff*Cp0*rho0);"
timelines (
  name Temp;
  outOfBounds clamp;
  fileName "$FOAM_CASE/Temp.data";
              );
    }

but the ramp down does not happen. How can I do that? By the way I am using transientSimpleFoam.

gschaider January 23, 2012 17:05

Quote:

Originally Posted by robingilbert (Post 340735)
Hi Phillipose,

Is it not possible to ramp down the values using timelines? i tried giving:

(
(90 0)
(92 10000)
(95 1000)
(100 100)
(105 0)
)

for

Code:

hotwall   
{
type        groovyBC;
value        uniform 291;
valueExpression "291";
gradientExpression "gradT";
fractionExpression "0";
variables      "heatFlux=10000;Cp0=1004;rho0=1.292;        alphaEff=pow(10,-4);gradT=heatFlux/(alphaEff*Cp0*rho0);"
timelines (
  name Temp;
  outOfBounds clamp;
  fileName "$FOAM_CASE/Temp.data";
              );
    }

but the ramp down does not happen. How can I do that?

Well of course you've got to USE the timeline somewhere. Something like

valueExpression "291+Temp";

or whatever makes physical sense with that timeline

robingilbert January 23, 2012 17:32

Oh ok, I am sorry, my mistake.

crossley90 June 21, 2012 11:50

Is it possible to create an oscillating velocity with this boundary condition?
I have looked at your post (below) and based on this it looks as though I could.

Quote:

Originally Posted by gschaider (Post 337742)
If you go for groovyBC then something like
Code:

   
    type groovyBC;
    timelines (
        {
            name inVel;
            outOfBounds clamp;
            fileName "$FOAM_CASE/inVel.data";
        }
    );
    valueExpression "-inVel*normal()";

should do the trick

After trying to apply my own code I don't seem to be successful. Could you give me a few pointers? I have looked through many posts for examples and this one is the most helpful.

side
{
type groovyBC;
fields
(
time Ux Uy Uz
);
lookuptables (
{
outOfBounds warn;
filename "time-velocity.txt";
}
);
}
from above get this error:
Please add the 'value' entry to the write function of the user-defined boundary-condition

P.S. I'm trying to apply an oscillating cross-wind hence the "time Ux Uy Uz"
If this helps this is a similar problem I have been having
http://www.cfd-online.com/Forums/ope...ross-wind.html

Any help would be very welcome at this point


All times are GMT -4. The time now is 22:31.