CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

flowRateInletVelocity help

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By philippose

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 19, 2014, 10:30
Default flowRateInletVelocity help
  #1
otq
New Member
 
Christopher Hughes
Join Date: Oct 2012
Posts: 27
Rep Power: 13
otq is on a distinguished road
I'm trying to implement the flowRateInletVelocity boundary condition. I've been looking over flowRateInletVelocity.C for OpenFOAM 2.1.1 and I have a few questions. I know these are relatively easy, but I can't seem to find a conclusive answer through Google.

I know that I cannot define both velocity and pressure at the inlet in OpenFOAM; therefore, I am setting pressure at the inlet and trying to use the mass flow rate set as the outlet to model pipe flow.

I understand that a positive value is inward for the above boundary condition, so a negative flowrate would result in outflow.

I'm just trying to understand what the boundary condition does. I get stuck up on three parts.

const scalar t = db().time().timeOutputValue()

is this pulling up the time variable from the controlDict file for transient cases or for steady cases the step time?

const scalar avgU = -flowRate_->value(t)/gSum(patch().magSf());

is this setting the flowRate pointer to be the value of t divided by the sum of all the cell surface faces along the patch? This is the more confusing of the three since flowRate in my case will be kg/s (phi is rho*U*A) but from my understanding it is setting it here to be units of seconds lengths^(-2).

Finally
tmp<vectorField> n = patch().nf();

is n a vectorfield containing all the normal faces of the patch and has units of 1/area? This makes sense because then

n*avgU/rhop

would give me a velocity (if avgU is some how kg/s since rhop is the density at the patch face and will have units of kg/m^3)

Thank you for your help.

Last edited by otq; June 19, 2014 at 11:33.
otq is offline   Reply With Quote

Old   June 23, 2014, 10:47
Default
  #2
otq
New Member
 
Christopher Hughes
Join Date: Oct 2012
Posts: 27
Rep Power: 13
otq is on a distinguished road
I've looked into it some more and I see that

tmp<vectorField> n = patch().nf()

gets me the normal faces so that the operator can assign a velocity for each cell face.

This means that avgU has units of [1 -2 -1 0 0 0 0] using openfoam notation.

As for

const scalar avgU = -flowRate_->value(t)/gSum(patch().magSf());

Will give me that value since

const scalar t = db().time().timeOutputValue();

means that the part of the code

-flowRate_->value(t)

returns the current time value of the flow rate (the negative is there to keep flow into the volume as the positive input). gSum(patch().magSF()) should give the units of [0 2 0 0 0 0 0]. Meaning avgU should have the correct units of [1 -2 -1 0 0 0 0] and is actually an average mass flux not an average velocity.

The only problem I have left is the exact mechanism where the mass flow rate is conserved.

I know it has to do with

operator==(n*avgU/rhop);

but that is an equal to operator not assignment.

operator is defined as

fvPatchField<vector>:: operator=
(
vectorField("value", dict, p.size())
);

this is the value provided as the input in the boundary conditions. I suppose there is an included header file that has a boolean regarding the operator that will continue to change U such that sum(rho*U*a_cell) is equal to the set mass flow rate.

Any information as to where that boolean is located would be appreciated as well as any clarification as to my current interpretation of the file would be welcomed.
otq is offline   Reply With Quote

Old   June 24, 2014, 05:06
Default
  #3
Senior Member
 
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 552
Rep Power: 25
philippose will become famous soon enough
Hello there,
A Good day to you.

I am not sure I understand exactly what your final question is, but let me try to make this a little simpler....:

* We know that Q = A*v (or for compressible cases: mdot = A*v*rho).

* For the flowRateInletVelocity, the value you are providing as input to the boundary condition is either volume flow rate (m^3/s) or mass flow rate (kg/s) depending on incompressible or compressible case.

* Since the boundary condition is a velocity condition, finally OpenFOAM needs to convert the value you give to a pure velocity term (m/s). In addition, since no other directional information is given, OpenFOAM forces the velocity at each mesh face of the patch to be normal to the face.

With this background, we can go a little further...:

* If incompressible, Q = A*v ==> v = Q/A
....You give as input "Q".... and internally OpenFOAM does:

avgU = -flowRate_->value(t)/gSum(patch().magSf());


* If compressible, mdot = A*v*rho ==> v = mdot/(A*rho)
....You give as input "mdot".... and internally OpenFOAM does:

avgU = -flowRate_->value(t)/gSum(patch().magSf());
avgU/rhop


So in both cases, you end up with the velocity which should be forced on each mesh face of the patch.... the only thing remaining is the direction in which this velocity should be imposed at each face.... this is done by the operation:

nf*avgU ==> nf is a vector field containing the normal to each mesh face of the patch .... multiplying the normal vector with the scalar "avgU" velocity imposes the required direction for the velocity.


Finally.... for the small confusion between "==" and "=".... in OpenFOAM, the "==" operator forces the value of the vectorField on the patch to be replaced with the given value (which is what a "fixedValue" boundary condition is supposed to do)... you should not consider the "==" to be a logical "is equal to" operator.... so essentially, the "==" is this case mathematically equivalent to a "=". That is one of the many "C++ magic tricks" you will find in OpenFOAM :-)

Hope this helps....

Have a nice day ahead!

Philippose
ms.hashempour likes this.
philippose is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 17:55.