CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

time varying vector boundary condition using patch normal

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 2 Post By gschaider

Reply
 
LinkBack Thread Tools Display Modes
Old   January 3, 2012, 11:24
Question time varying vector boundary condition using patch normal
  #1
New Member
 
Peter Maday
Join Date: Aug 2011
Posts: 14
Rep Power: 5
mpeti is on a distinguished road
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
mpeti is offline   Reply With Quote

Old   January 3, 2012, 18:10
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by mpeti View Post
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
gschaider is online now   Reply With Quote

Old   January 4, 2012, 02:21
Default
  #3
Senior Member
 
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 530
Rep Power: 16
philippose will become famous soon enough
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
philippose is offline   Reply With Quote

Old   January 4, 2012, 06:25
Default
  #4
New Member
 
Peter Maday
Join Date: Aug 2011
Posts: 14
Rep Power: 5
mpeti is on a distinguished road
Quote:
Originally Posted by philippose View Post
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
mpeti is offline   Reply With Quote

Old   January 4, 2012, 06:36
Default
  #5
Senior Member
 
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 530
Rep Power: 16
philippose will become famous soon enough
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
philippose is offline   Reply With Quote

Old   January 23, 2012, 17:43
Default
  #6
Member
 
Robin Gilbert
Join Date: Jan 2010
Posts: 66
Rep Power: 7
robingilbert is on a distinguished road
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.

Last edited by robingilbert; January 23, 2012 at 18:19.
robingilbert is offline   Reply With Quote

Old   January 23, 2012, 18:05
Default
  #7
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by robingilbert View Post
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
gschaider is online now   Reply With Quote

Old   January 23, 2012, 18:32
Default
  #8
Member
 
Robin Gilbert
Join Date: Jan 2010
Posts: 66
Rep Power: 7
robingilbert is on a distinguished road
Oh ok, I am sorry, my mistake.
robingilbert is offline   Reply With Quote

Old   June 21, 2012, 11:50
Unhappy
  #9
New Member
 
Dave Crossley
Join Date: Oct 2010
Posts: 18
Rep Power: 6
crossley90 is on a distinguished road
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 View Post
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
Oscilating cross-wind

Any help would be very welcome at this point
crossley90 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
TimeVaryingMappedFixedValue irishdave OpenFOAM Running, Solving & CFD 28 May 28, 2015 13:37
Adding heat source to chtMultiRegionFoam maddalena OpenFOAM Programming & Development 58 July 16, 2014 02:57
Using starToFoam clo OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 33 September 26, 2012 04:04
Convergence moving mesh lr103476 OpenFOAM Running, Solving & CFD 30 November 19, 2007 15:09
NACA0012 geometry/design software needed Franny Main CFD Forum 13 July 7, 2007 15:57


All times are GMT -4. The time now is 13:24.