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/)
-   -   Imposing PIV (2D) experimental data at turbulentDFSEMInlet for LES (https://www.cfd-online.com/Forums/openfoam-solving/232517-imposing-piv-2d-experimental-data-turbulentdfseminlet-les.html)

t.teschner December 17, 2020 02:43

Imposing PIV (2D) experimental data at turbulentDFSEMInlet for LES
 
I have 2D planar PIV data available from experiments (velocity field, Reynolds stresses and length scale information) and want to impose those at the inlet of the domain for the turbulentDFSEMInlet boundary condition.

Naturally, the PIV data - recorded at coordinates y and z (for the sake of argument here) - does not coincide with the coordinates y and z of the mesh at the inlet. Is there some functionality that can take the experimental data and y and z coordinates, interpolate the values onto the mesh and then write the required boundaryData file as an output within the constant/boundaryData/U/0/ directory?

dlahaye December 17, 2020 03:20

mapFields utility
see https://www.openfoam.com/documentati...mapFields.html including tutorials and
Section A.2 of https://openfoam.com/documentation/u...-utilities.php for broader scope

t.teschner December 17, 2020 05:30

yes, I am aware of mapFields and how to use it to map solutions information from one simulation onto another, but I have experimental data in a non Openfoam format available (i.e. x, y and corresponding experimental value). The questing would then, probably, rather be, how do I get my experimental data into a form mapFields can understand?

dlahaye December 17, 2020 06:32

Aha.

Your measured data is a scalar field on 2D planar grid, correct?

Does is suffice to write measurement locations as a (quadrilateral?) mesh and the measured data as a scalar field on there mesh?

t.teschner December 17, 2020 06:48

Quote:

Originally Posted by dlahaye (Post 790913)
Your measured data is a scalar field on 2D planar grid, correct?

Yes, essentially 2D PIV data with x and y coordinates plus the measured quantity

Quote:

Originally Posted by dlahaye (Post 790913)
Does is suffice to write measurement locations as a (quadrilateral?) mesh and the measured data as a scalar field on there mesh?

Yes, that would work. My question is how I should format the data in a way mapFields, or a similar utility, can understand my essentially 2D structured dataset. In particular, the turbulentDFSEMInlet boundary condition is able to read boundary data (and also do some automatic mapping, it seems), but that data is just a single array of values and as far as I can see there is no grid location information attached to the datasets, so I wonder how I could resolve this mismatch in locations (and dimensions as well).

dlahaye December 17, 2020 08:53

Not sure. Should study tutorials myself.

t.teschner January 21, 2021 04:33

turned out to be actually not that difficult, i did some more digging and came up with the following (in case someone finds this in the future):

We need to provide a 1D list / array of data for the velocity U, reynolds stresses R and an integral length scale L. Then, we create 4 files in these locations (assuming we are currently in the root directry of the case, i.e. where we have the 0, constant and system directory):

constant/boundaryData/points
constant/boundaryData/<inlet-patch-name>/0/U
constant/boundaryData/<inlet-patch-name>/0/R
constant/boundaryData/<inlet-patch-name>/0/L

where we need to insert the name of the inlet patch name here for <inlet-patch-name>. For example, if our inlet is called "velocityInlet", then the U file would be located at constant/boundaryData/velocityInlet/0/U.

All files follow the same syntax and only the data entries are different for scalars, vectors and tensors:

Code:

// scalar data
(
scalar_0
scalar_1
scalar_2
...
scalar_N
)

Code:

// vector data
(
(vector.x_0 vector.y_0 vector.z_0)
(vector.x_1 vector.y_1 vector.z_1)
(vector.x_2 vector.y_2 vector.z_2)
...
(vector.x_N vector.y_N vector.z_N)
)

Code:

// tensor data
(
(tensor.xx_0 tensor.xy_0 tensor.xw_0 tensor.vv_0 tensor.vw_0 tensor.zz_0)
(tensor.xx_1 tensor.xy_1 tensor.xw_1 tensor.vv_1 tensor.vw_1 tensor.zz_1)
(tensor.xx_2 tensor.xy_2 tensor.xw_2 tensor.vv_2 tensor.vw_2 tensor.zz_2)
...
(tensor.xx_N tensor.xy_N tensor.xw_N tensor.vv_N tensor.vw_N tensor.zz_N)
)

Note that OpenFOAM expects Reynolds stresses R_uu to be greater than zero, so just impose a small value here if that happens to be 0 in your case, something like 1e-10 should work fine.

As an example, the points file could look like this (assuming data is only available at the inlet along a 1D line in the y direction):
Code:

(
(0 0 0)
(0 0.1 0)
(0 0.2 0)
(0 0.3 0)
(0 0.5 0)
(0 0.98 0)
(0 1 0)
)

Those coordinates do not have to coincide with your mesh. If you have 2D data available from PIV / experiments, as is the case for me, you can just write the data here following the format above. Then, for the boundary conditions in the 0/U file, the following can be used:

Code:

velocityInlet
{
    type            turbulentDFSEMInlet;
    delta          0.0127; // height of your inlet
    mapMethod      nearestCell;
    value          uniform (10 0 0); // place holder, ignored as far as I can see ...
}

With mapMethod nearestCell, OpenFOAM will automatically interpolate / extrapolate our provided data to the cells. It seems to be working nicely as well if you just provide a 1D line, OpenFOAM will still map that profile to the 2D inlet plane and use a constant extrapolation in the direction which is not specified.

By providing the data in the constant/boundaryData folder for the physical quantities, it also seems that the simulation does stall (as described here), though there still seems to be an issue with the velocity magnitude, but I did not have time as of now to investigate that further.

Yuling_ April 25, 2024 04:50

Thanks a lot for the solution!
How do you obtain length scale information from PIV? Do you assume a constant value throughout the field?


All times are GMT -4. The time now is 05:40.