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

csv table with measured flows as inflow possible?

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By Yann

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 8, 2023, 23:47
Default csv table with measured flows as inflow possible?
  #1
New Member
 
Tobias
Join Date: Jul 2022
Posts: 14
Rep Power: 3
dalasrevo is on a distinguished road
Hello everyone,

I have a question that has probably already been answered somewhere. In that case, I apologize that I apparently did not find the right search terms. Then I would also appreciate a reference to a suitable thread.

I am working on the following problem:
I am working on an experimental setup for which real measurements exist. First the water flows in a basin in free level, then it is passed through a tube filled only with water and ends again in a basin with free level. In the first basin, the flow is split, then reunited in the tube. I work with interFoam. Now my simulated values do not match the experimental values, the distribution of splitting is completely different from the experimental values.
However, as I said, measured values exist in the open channel for the discharge in the form of a csv table at the point still open to the top where the flow is split. Measured values exist for different points in an x-y coordinate system in the water phase.
Is there a way that I can use this table as an inflow condition? So far I have

U
inlet
{
type variableHeightFlowRateInletVelocity;
flowRate $inletFlowRate;
alpha alpha.water;
value uniform (0 0 0);
}
to ensure a constant inlet flow rate for the free level basin.
Any hint would be appreciated

Best regards
dalasrevo is offline   Reply With Quote

Old   January 9, 2023, 04:09
Default
  #2
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,053
Rep Power: 26
Yann will become famous soon enough
Hello,

If you are using a recent version of OpenFOAM, the flowRate parameter of variableHeightFlowRateInletVelocity is a type Function1 which means you can use time-varying tables or files as an input:

Code:
inlet
{
	type		variableHeightFlowRateInletVelocity;
	alpha		alpha.water;
	value		uniform (0 0 0);
	flowRate	table
	(
		(0.0 3)
		(1.0 6)
	);
}
or

Code:
inlet
{
	type			variableHeightFlowRateInletVelocity;
	alpha			alpha.water;
	value			uniform (0 0 0);
	flowRate		csvFile;
	nHeaderLine     1;
	refColumn       0;
	componentColumns ( 1 );
	separator       ",";
	mergeSeparators no;
	file            "<constant>/inlet.csv";
}
Those are only examples of table/csv file definition found in the tutorials. The exact syntax might depend on the OpenFOAM version you are using, so you may have to search for it to find the proper way to define it, but it should be possible.

Regards,
Yann
Neshat and dalasrevo like this.
Yann is offline   Reply With Quote

Old   January 9, 2023, 04:19
Default
  #3
New Member
 
Tobias
Join Date: Jul 2022
Posts: 14
Rep Power: 3
dalasrevo is on a distinguished road
Thank you, I'll have a look into it but on the first sight I think that is exactly what I was looking for
dalasrevo is offline   Reply With Quote

Old   January 15, 2023, 11:54
Default
  #4
New Member
 
Tobias
Join Date: Jul 2022
Posts: 14
Rep Power: 3
dalasrevo is on a distinguished road
I tried to understand the use of csvFile, but unfortunately I don't.
My CSV looks like this:

Code:
y, z, vX, vY, vZ
0.1, 0.1, 0.31, -0.23, 0.01
0.1, 0.2, 0.59, -0.11, 0.12
0.2, 0.1, 0.31, 0.22, 0.04
0.2, 0.2, 0.32, -0.12, 0.13
...
So, my problem is 3 dimensional, I have an inlet patch at x=0 and measured flows at coordinates y, z consisting of the components vX, vY and vZ. The flow will stay constant over time.

From CSV.H (OpenFOAM 2212) I read

Code:
Description
    Templated CSV function.
 
    Reference column is always a scalar, e.g. time.
 
    Usage:
    \verbatim
        <entryName> csvFile;
        <entryName>Coeffs
        {
            nHeaderLine         4;          // number of header lines
            refColumn           0;          // reference column index
            componentColumns    (1 2 3);    // component column indices
            separator           ",";        // optional (defaults to ",")
            mergeSeparators     no;         // merge multiple separators
            file                "fileXYZ";  // name of csv data file
            outOfBounds         clamp;      // optional out-of-bounds handling
            interpolationScheme linear;     // optional interpolation scheme
        }
    \endverbatim
The easy part is
Code:
nHeaderLine


So I need a
Code:
refColumn
(a scalar, e.g. time, but what could that be in my case?). I guess that
Code:
componentColumns
would be my vX, vY and vZ. But I don't get it how I can assign these velocity components to a coordinate.
dalasrevo is offline   Reply With Quote

Old   January 16, 2023, 05:38
Default
  #5
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,053
Rep Power: 26
Yann will become famous soon enough
Hello Tobias,

My apologies, I did not pay enough attention to your first message and my answer was meant to set a time-varying flowrate.

The variableHeightFlowRateInletVelocity BC is meant to maintain a user-specified flowrate on a phase with variable height. For instance on an inlet partially filled with water, this BC will allow to define a flowrate for the water, and the velocity on the patch will adjust to maintain this flowrate (if water height on the patch increases, the velocity will decrease to maintain the proper flowrate, and vice versa)
So you cannot define a spatially varying velocity with this condition as it is not really what it has been designed to do.

You should have a look at the uniformFixedValue condition, which should allow to define both time and space varying velocity. Unfortunately I'm not sure there are examples with space varying parameters in the tutorials so you might have to dig a bit into it to find how to use it.

Another option would be to use the timeVaryingMappedFixedValue condition. There is one tutorial using it to map experimental data to the inlet, but it requires to properly format input data: $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDailyExptInlet

I don't have experience with those conditions so I cannot guarantee it will work as you expect but I think it is worth having a look at it.

Regards,
Yann
Yann 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
QGDsolver - OpenFOAM computational framework for fluid flows based on regularized equ mkraposhin OpenFOAM Announcements from Other Sources 7 September 13, 2021 03:09
Swirl component in inflow BC for 2d axisymmetric flows vishalsacharya OpenFOAM Pre-Processing 2 November 2, 2018 05:33
Derivation of the pressure-correction equation for compressible flows luftraudi Main CFD Forum 0 July 17, 2012 06:35
penalty-projection method for incompressible flows Isabel Main CFD Forum 0 May 8, 2006 03:49
Prescribed inflow velocity profile - how to? Alan Main CFD Forum 10 October 28, 2005 12:14


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