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

How to get the velocities corresponding to face/cell centers as output from a surface

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

Like Tree2Likes
  • 1 Post By crubio.abujas
  • 1 Post By crubio.abujas

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 21, 2020, 09:54
Default How to get the velocities corresponding to face/cell centers as output from a surface
  #1
Member
 
Arijit Saha
Join Date: Feb 2019
Location: Germany
Posts: 44
Rep Power: 3
ari003 is on a distinguished road
Hi, guys I have been trying to do some simulation in OF7 and there I noticed that it has really changed a lot since it s previous version.
So basically I was trying the pitzdaily tutorial and my aim is to get the output velocities of each face/cell and feed it as an input boundary of another pitz daily case setup. I have cut out a surface using surfaces dict and got the velocities but that corresponds to the vertex points. To make it clear lets say I have 30 cells and 62 vertex points so the velocity which are needed to be fed in the new simulation should be 30 in number corresponding to each cell and not 62. So, how can I get the output velocity corresponding to each cell/face in my first pitzdaily case setup? It will of great help if anyone responds to my thread.
ari003 is offline   Reply With Quote

Old   May 22, 2020, 09:23
Default
  #2
Member
 
Arijit Saha
Join Date: Feb 2019
Location: Germany
Posts: 44
Rep Power: 3
ari003 is on a distinguished road
Can anyone help out to solve this issue? I have been stuck in this for the past 2 days. Any kind of help will greatly encouraged.
ari003 is offline   Reply With Quote

Old   May 22, 2020, 13:24
Default A way to start, but further work is needed
  #3
Member
 
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 34
Rep Power: 4
crubio.abujas is on a distinguished road
Hello ari003,

Let me go bit by bit and tell me if I got something wrong. You want to do two separate simulations, pitzdaily1 and pitzdaily2.
1) From pitzdaily1 you want to extract the velocity profile of the outlet.
2) You want to use this in velocity profile as an input for the pitzdaily2.
right?

If that is the case, the point 1 can be addressed with a functionObject like this one:

Code:
outletSampled
{
    type            surfaceFieldValue;
    libs            ("libfieldFunctionObjects.so");
    regionType      patch;
    name            outlet;
    operation       none;

    writeFields     true;
    surfaceFormat   foam; 
    fields
    ( 
        U 
    );
}
This will write the results into the postProcess folder into 4 separate files:
  • faceCenters - with the coordinte of the face centers
  • vectorFields/U - with the velocity on the face centers
  • faces - with the reference of the points conforming the face
  • points - with the coordinate of all the points conforming the face
with that you shall have enough information to do the point 2, although some processing is required.


Ok, lets go with the point 2. How do you feed this information as a boundary condition? You can check the pitzDailyExptInlet tutorial, which uses the timeVaryingMappedFvPatchField boundary condition. What this does is quite close to what you want, it reads a PatchProfile and uses it as a boundary condition. By default it tries to read the input profile in the folder constant/boundaryData/<patch_name> where it expects to find:
  • a file "points" with the coordinate of all the points defining the profile
  • a folder for each timestep the profile is defined. This profile must have a field for each profile correspondent with the point files previously defined.
That is really similar to what we get from pitzdaily1, right? You may be tempted to just use the faceCenter and the U profiles, renamed properly and feed into pitzdaily2 but that wont work. That is because geometrically these two patches don't match. They have different sizes and are places in different points in the space, so you have to figure out a way to project the output information into de input geometry for that to work.

You can try doing further manipulation of the data for adequate the timeVaryingMappedFvPatchField, in that case maybe a different surfaceFormat may be better, depending on the platform you're more used to worh with.
Other option may be merging two pitzlyday meshes and do this in a single run, rather making the connection explicit or using some king of interface between these two.

I hope that helps you to going further with the problem!
ari003 likes this.
crubio.abujas is online now   Reply With Quote

Old   May 22, 2020, 14:36
Default
  #4
Member
 
Arijit Saha
Join Date: Feb 2019
Location: Germany
Posts: 44
Rep Power: 3
ari003 is on a distinguished road
First of all I want to thank you for such a great effort. Yaa, I ve taken a slice by using surface dict which is giving the value corresponding to points but I want corresponding to cell center. I m using Openfoam 7 and that might be a reason why I m unable to get these functionObject features. Bdw which version you are using and how did you het the dict of functionObject?
ari003 is offline   Reply With Quote

Old   May 22, 2020, 15:45
Default
  #5
Member
 
Arijit Saha
Join Date: Feb 2019
Location: Germany
Posts: 44
Rep Power: 3
ari003 is on a distinguished road
I will be eagerly waiting for your reply Sir, as my work is stuck at this point and I need to get it done as soon as possible. I hope you understand.
ari003 is offline   Reply With Quote

Old   May 23, 2020, 02:57
Default How to get center values
  #6
Member
 
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 34
Rep Power: 4
crubio.abujas is on a distinguished road
hi again ari003,


Quote:
Originally Posted by ari003 View Post
First of all I want to thank you for such a great effort. Yaa, I ve taken a slice by using surface dict which is giving the value corresponding to points but I want corresponding to cell center.
If in the end you want to apply a boundary condition I think the proper thing to follow shall be the face value. Anyway, I think if you're using a zeroGradient condition on the outlet OF is just using the same cell center value to the faceCenter, without any interpolation. That way the gradient between these two point shall be 0.

Anyway, in the functionObject you can set the interpolationScheme to cell. According to the documentation this interpolationScheme considers the cell center value to be applicable to the entire cell, so combined with your surfaceDict you should get the results you want. Concerning the coordinates of the centers, if on your surfaceDict you've already sliced the region of interest, the "faceCenter" shall match the center of these cells. If you want to be more precise you can check cellCenters (http://openfoamwiki.net/index.php/Contrib/cellCenters), which I assume creates a vector field with the position of the center, combined with the interpolationScheme=cell that should give you the expected result.

If is just post-processing you can try checking paraview. There you can see the value of the cells/points, selected the interesting ones using graphical tools and exporting into a spreadsheet.

However, I want to highlight that output and inlet geometries are different and for creating a match among them you must do some further processing.

Quote:
Originally Posted by ari003 View Post
I m using Openfoam 7 and that might be a reason why I m unable to get these functionObject features. Bdw which version you are using and how did you het the dict of functionObject?
I'm using OF7 as well. Concerning the funcionObject Dict, I just look around the src folder using the commands find and grep to locate potentially useful functionObjects. The .H file use to have a header with information on how to call these objects. Then I just sequentially fill the functionObject, run and listen to the complains of OF e.g it tells you the field "surfaceType" is missing, you add it with a dummy value, then is tell you "dummy value is not valid. These are the valid values" pick one and repeat. It may not be the most elegant way to do it... but it works. You can also use grep to look on the tutorials for any case wich uses these kind of object.


Hope it helps!
ari003 likes this.
crubio.abujas is online now   Reply With Quote

Old   May 25, 2020, 14:48
Default
  #7
Member
 
Arijit Saha
Join Date: Feb 2019
Location: Germany
Posts: 44
Rep Power: 3
ari003 is on a distinguished road
Respected Sir,
Your response was so generous that I am finally able to get the desired output. Thank you. If I need further assistance I ll write it here.
Yours faithfully
Arijit

Last edited by ari003; May 25, 2020 at 17:19.
ari003 is offline   Reply With Quote

Old   May 25, 2020, 18:57
Default
  #8
Member
 
Arijit Saha
Join Date: Feb 2019
Location: Germany
Posts: 44
Rep Power: 3
ari003 is on a distinguished road
Quote:
Originally Posted by crubio.abujas View Post
Hello ari003,

Let me go bit by bit and tell me if I got something wrong. You want to do two separate simulations, pitzdaily1 and pitzdaily2.
1) From pitzdaily1 you want to extract the velocity profile of the outlet.
2) You want to use this in velocity profile as an input for the pitzdaily2.
right?

If that is the case, the point 1 can be addressed with a functionObject like this one:

Code:
outletSampled
{
    type            surfaceFieldValue;
    libs            ("libfieldFunctionObjects.so");
    regionType      patch;
    name            outlet;
    operation       none;

    writeFields     true;
    surfaceFormat   foam; 
    fields
    ( 
        U 
    );
}
This will write the results into the postProcess folder into 4 separate files:
  • faceCenters - with the coordinte of the face centers
  • vectorFields/U - with the velocity on the face centers
  • faces - with the reference of the points conforming the face
  • points - with the coordinate of all the points conforming the face
with that you shall have enough information to do the point 2, although some processing is required.


Ok, lets go with the point 2. How do you feed this information as a boundary condition? You can check the pitzDailyExptInlet tutorial, which uses the timeVaryingMappedFvPatchField boundary condition. What this does is quite close to what you want, it reads a PatchProfile and uses it as a boundary condition. By default it tries to read the input profile in the folder constant/boundaryData/<patch_name> where it expects to find:
  • a file "points" with the coordinate of all the points defining the profile
  • a folder for each timestep the profile is defined. This profile must have a field for each profile correspondent with the point files previously defined.
That is really similar to what we get from pitzdaily1, right? You may be tempted to just use the faceCenter and the U profiles, renamed properly and feed into pitzdaily2 but that wont work. That is because geometrically these two patches don't match. They have different sizes and are places in different points in the space, so you have to figure out a way to project the output information into de input geometry for that to work.

You can try doing further manipulation of the data for adequate the timeVaryingMappedFvPatchField, in that case maybe a different surfaceFormat may be better, depending on the platform you're more used to worh with.
Other option may be merging two pitzlyday meshes and do this in a single run, rather making the connection explicit or using some king of interface between these two.

I hope that helps you to going further with the problem!
While I was successful in doing the first part but with the second part I m facing some trouble while running. I ve made the boundaryData folder with my own values as it is done the pitzdailyExpInlet but still the error persist. The error is as follows:-
Reading field U

#0 Foam::error:rintStack(Foam::Ostream&) at ??:?
#1 Foam::sigFpe::sigHandler(int) at ??:?
#2 ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3 Foam:ointToPointPlanarInterpolation::calcCoordin ateSystem(Foam::Field<Foam::Vector<double> > const&) const at ??:?
#4 Foam:ointToPointPlanarInterpolation:ointToPoin tPlanarInterpolation(Foam::Field<Foam::Vector<doub le> > const&, Foam::Field<Foam::Vector<double> > const&, double, bool) at ??:?
#5 Foam::timeVaryingMappedFvPatchField<Foam::Vector<d ouble> >::checkTable() at ??:?
#6 Foam::timeVaryingMappedFvPatchField<Foam::Vector<d ouble> >::map() at ??:?
#7 Foam::timeVaryingMappedFixedValueFvPatchField<Foam ::Vector<double> >::timeVaryingMappedFixedValueFvPatchField(Foam::f vPatch const&, Foam:imensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) at ??:?
#8 Foam::fvPatchField<Foam::Vector<double> >::adddictionaryConstructorToTable<Foam::timeVaryi ngMappedFixedValueFvPatchField<Foam::Vector<double > > >::New(Foam::fvPatch const&, Foam:imensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) at ??:?
#9 Foam::fvPatchField<Foam::Vector<double> >::New(Foam::fvPatch const&, Foam:imensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) in "/opt/openfoam7/platforms/linux64GccDPInt32Opt/bin/pimpleFoam"
#10 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::Boundary::readField(Foam:imensio nedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::dictionary const&) in "/opt/openfoam7/platforms/linux64GccDPInt32Opt/bin/pimpleFoam"
#11 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::readFields(Foam::dictionary const&) in "/opt/openfoam7/platforms/linux64GccDPInt32Opt/bin/pimpleFoam"
#12 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::readFields() in "/opt/openfoam7/platforms/linux64GccDPInt32Opt/bin/pimpleFoam"
#13 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject const&, Foam::fvMesh const&) in "/opt/openfoam7/platforms/linux64GccDPInt32Opt/bin/pimpleFoam"
#14 ? in "/opt/openfoam7/platforms/linux64GccDPInt32Opt/bin/pimpleFoam"
#15 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#16 ? in "/opt/openfoam7/platforms/linux64GccDPInt32Opt/bin/pimpleFoam"
Floating point exception (core dumped)
arijit@arijit-VirtualBox:~/Desktop/pitzDaily$ ^C
arijit@arijit-VirtualBox:~/Desktop/pitzDaily$

Any idea to troubleshoot this will be really appreciable.
Thank you
ari003 is offline   Reply With Quote

Old   May 26, 2020, 02:49
Default Add zpoints to interpolate in z-axis
  #9
Member
 
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 34
Rep Power: 4
crubio.abujas is on a distinguished road
Hello again Arijit!

Quote:
Originally Posted by ari003 View Post
While I was successful in doing the first part but with the second part I m facing some trouble while running. I ve made the boundaryData folder with my own values as it is done the pitzdailyExpInlet but still the error persist. The error is as follows:-
Reading field U
I've made some investigation on the case and it seems that timeVaryingMappedFixedValue is trying to do an interpolation on the Z axis, but as the model is 2D the set of points provided only have a single Z value (so zmax and zmin are equal and probably the interpolation blows up dividing by 0).

If you check the pitzdailyExpInlet tutorial and see the definition of boundaryData/inlet/points you can see that there is an duplicated set of points with an offset in z-direction.

Code:
/* - boundaryData/inlet/points  - */

70  // Ensure to change the length of the array!
(

// min z 
(-0.0206 0.000125 0)
(-0.0206 0.000375 0)
(-0.0206 0.000625 0)
...

// max z (A duplicate set of coordinates with different Z value)
(-0.0206 0.000125 0.173)
(-0.0206 0.000375 0.173)
(-0.0206 0.000625 0.173)
...

)
Of course you must create a duplicate set on de U field to be interpolated against. Ensure that the vector lengths at the beginning match the number of elements inside!

I've tried the case with this modifications and it worked fine, so lets hope it works well for you as well!
crubio.abujas is online now   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] Surface triangulation using snappyHexMesh shaileshbg OpenFOAM Meshing & Mesh Conversion 4 October 17, 2019 04:42
How To Create Fowcs William Hawkings Surface in Fluent? marinkobezu FLUENT 7 October 25, 2018 10:51
How to output boundary cells' information like centers and volume keepfit OpenFOAM 0 December 28, 2016 15:29
Output data sets for each monitored surface danielcollins SU2 2 June 21, 2016 12:44
Free surface Velocities in the MAC based Methods Maciej Matyka Main CFD Forum 6 August 16, 2004 18:02


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