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

sample from curved surface

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

Like Tree12Likes
  • 10 Post By linnemann
  • 1 Post By linnemann
  • 1 Post By linnemann

Reply
 
LinkBack Thread Tools Display Modes
Old   April 18, 2012, 21:58
Default sample from curved surface
  #1
Member
 
Adam
Join Date: Jun 2011
Posts: 32
Rep Power: 6
Smed is on a distinguished road
Is it possible to sample data from a curved surface? I know that you can sample from a plane by specifying the base point and normal vector, but I want to specify an arc, as shown in the attached drawing.
Attached Images
File Type: png curvedSurfaceSample.png (70.8 KB, 112 views)
Smed is offline   Reply With Quote

Old   April 19, 2012, 03:19
Default
  #2
Senior Member
 
linnemann's Avatar
 
Niels Nielsen
Join Date: Mar 2009
Location: NJ - Denmark
Posts: 471
Rep Power: 16
linnemann will become famous soon enough
Hi

Yes it certainly is. Below is some code that shows how to use a stl surface to sample with. Note that the mesh resolution of the stl file will influence how well it interpolates/averages. Also make sure that the stl file is only as large as the mesh as it will produce false data if the stl file expands larger than the mesh domain.

I have checked it and it works correctly even with odd shapes. The stl file must reside in the constant/triSurface/ folder.

Code:
functions
{
    faceObj1
    {
        type            faceSource;
        functionObjectLibs ("libfieldFunctionObjects.so");

        enabled         true;
        outputControl   outputTime;

        // Output to log&file (true) or to file only
        log             true;

        // Output field values as well
        valueOutput     true;

        // Type of source: patch/faceZone/sampledSurface
        source          sampledSurface;

//         // if patch or faceZone: name of patch or faceZone
//         sourceName      movingWall;

        //// if sampledSurface: dictionary with a sampledSurface
        //// Note: will not sample surface fields.
        sampledSurfaceDict
        {
           // Sampling on triSurface
           type        sampledTriSurfaceMesh;
           surface     Scale_1.stl;
           source      cells;  // sample cells or boundaryFaces
           interpolate false;
        }

        // Operation: areaAverage/sum/weightedAverage ...
        operation       areaNormalIntegrate;

        fields
        (
            p
            U
        );
    }
}
The following operations are available.

Code:
         "none",
         "sum",
         "average",
         "weightedAverage",	
         "areaAverage",	
         "areaIntegrate",
         "min",
         "max",
         "CoV",
         "areaNormalAverage",
         "areaNormalIntegrate"
akidess, rflats, fumiya and 7 others like this.
__________________
Linnemann

PS. I do not do personal support, so please post in the forums.
linnemann is offline   Reply With Quote

Old   April 19, 2012, 11:54
Default
  #3
Member
 
Adam
Join Date: Jun 2011
Posts: 32
Rep Power: 6
Smed is on a distinguished road
Niels,

Thanks for your response! Can this code be executed as a post process (like sampleDict) or does it need to be placed in controlDict before the case is run?
Smed is offline   Reply With Quote

Old   April 25, 2012, 13:39
Default
  #4
Senior Member
 
Mihai Pruna
Join Date: Apr 2010
Location: Boston
Posts: 190
Blog Entries: 1
Rep Power: 8
mihaipruna is on a distinguished road
hi, if I want to use the STL from SHM, do I have to give it the relative path?
__________________
Mihai Pruna's Bio
mihaipruna is offline   Reply With Quote

Old   April 25, 2012, 15:28
Default
  #5
Senior Member
 
linnemann's Avatar
 
Niels Nielsen
Join Date: Mar 2009
Location: NJ - Denmark
Posts: 471
Rep Power: 16
linnemann will become famous soon enough
my own words in the above post

Quote:
The stl file must reside in the constant/triSurface/ folder.
__________________
Linnemann

PS. I do not do personal support, so please post in the forums.
linnemann is offline   Reply With Quote

Old   April 25, 2012, 15:35
Default
  #6
Senior Member
 
Mihai Pruna
Join Date: Apr 2010
Location: Boston
Posts: 190
Blog Entries: 1
Rep Power: 8
mihaipruna is on a distinguished road
sorry I should have read more carefully.

that's where I had the STL.
The mistake I made must lie elsewhere in my sampledict file.
So I'm going to use the example you provided
__________________
Mihai Pruna's Bio
mihaipruna is offline   Reply With Quote

Old   April 26, 2012, 14:29
Default
  #7
Senior Member
 
Mihai Pruna
Join Date: Apr 2010
Location: Boston
Posts: 190
Blog Entries: 1
Rep Power: 8
mihaipruna is on a distinguished road
linneman. can you please post your entire sampleDict?
I don't get any output. It just says Time 0, 100 etc.

nm seems to work now!
__________________
Mihai Pruna's Bio

Last edited by mihaipruna; April 30, 2012 at 17:00.
mihaipruna is offline   Reply With Quote

Old   March 5, 2013, 02:39
Default
  #8
Member
 
Albert Tong
Join Date: Dec 2010
Location: Perth, WA, Australia
Posts: 76
Blog Entries: 1
Rep Power: 7
tfuwa is on a distinguished road
Hi Foamers,

This may sound silly, but how to generate a stl file for the curved surface in the first place? Thanks.


Quote:
Originally Posted by linnemann View Post
Hi

Yes it certainly is. Below is some code that shows how to use a stl surface to sample with. Note that the mesh resolution of the stl file will influence how well it interpolates/averages. Also make sure that the stl file is only as large as the mesh as it will produce false data if the stl file expands larger than the mesh domain.

I have checked it and it works correctly even with odd shapes. The stl file must reside in the constant/triSurface/ folder.

Code:
functions
{
    faceObj1
    {
        type            faceSource;
        functionObjectLibs ("libfieldFunctionObjects.so");

        enabled         true;
        outputControl   outputTime;

        // Output to log&file (true) or to file only
        log             true;

        // Output field values as well
        valueOutput     true;

        // Type of source: patch/faceZone/sampledSurface
        source          sampledSurface;

//         // if patch or faceZone: name of patch or faceZone
//         sourceName      movingWall;

        //// if sampledSurface: dictionary with a sampledSurface
        //// Note: will not sample surface fields.
        sampledSurfaceDict
        {
           // Sampling on triSurface
           type        sampledTriSurfaceMesh;
           surface     Scale_1.stl;
           source      cells;  // sample cells or boundaryFaces
           interpolate false;
        }

        // Operation: areaAverage/sum/weightedAverage ...
        operation       areaNormalIntegrate;

        fields
        (
            p
            U
        );
    }
}
The following operations are available.

Code:
         "none",
         "sum",
         "average",
         "weightedAverage",    
         "areaAverage",    
         "areaIntegrate",
         "min",
         "max",
         "CoV",
         "areaNormalAverage",
         "areaNormalIntegrate"
__________________
Kind regards,

Albert
tfuwa is offline   Reply With Quote

Old   March 5, 2013, 08:57
Default
  #9
Member
 
Adam
Join Date: Jun 2011
Posts: 32
Rep Power: 6
Smed is on a distinguished road
Quote:
Originally Posted by tfuwa View Post
Hi Foamers,

This may sound silly, but how to generate a stl file for the curved surface in the first place? Thanks.
Pretty much any method that can be used to create a mesh can also create an stl file. I created the desired sampling surface with blockMesh (curved it using the edges keyword), then converted it to an stl using foamToSurface. You could also use a program like gmsh or any of the commercial options.
Smed is offline   Reply With Quote

Old   October 12, 2015, 19:30
Default Not sure how to interpret the resulting data from using an .stl file to sample data.
  #10
New Member
 
Chenelle Basson
Join Date: May 2014
Location: South Africa
Posts: 5
Rep Power: 4
Chenelle is on a distinguished road
Hi!

I have used the .stl method for sampling data on a curved surface and as a result obtain many data files, but I'm not sure what data is being stored in these files.

I have used the areaNormalIntegrate operation on the velocity field in order to obtain the massflow through certain parts of my domain.

In the post processing folder I have a folder for each of the .stl surfaces that I sample for instance 'F:\Axial\1\postProcessing\A1' (where the surface is named A1). In this folder I find a folder named '2' (which is my 'startTime') and a folder named 'surface'. The folder named 'surface' contains a folder for each time step.

The file I find in 'F:\Axial\1\postProcessing\A1\2' is called 'faceSource.dat' and looks as follows:

# Source : sampledSurface sampledSurface
# Faces : 10364
# Time sum(magSf) areaNormalIntegrate(U)
2.010000e+00 2.444231e-05 (1.517481e-07 0.000000e+00 0.000000e+00)
2.020000e+00 2.444231e-05 (3.455922e-07 0.000000e+00 0.000000e+00)
2.030000e+00 2.444231e-05 (3.599368e-07 0.000000e+00 0.000000e+00)
.
.
.

This continues on until my final time step.

In the folder named 'surface' containing folders for each timestep I find the following file named 'U_sampledSurface_sampledSurface.dat' (the path is 'F:\Axial\1\postProcessing\A1\surface\2.01'):

# vtk DataFile Version 2.0
sampleSurface
ASCII
DATASET POLYDATA
POINTS 5480 float
-7.21109e-05 -0.0471719 -0.152
-5.07447e-05 -0.047172 -0.152
-4.00616e-05 -0.047172 -0.152
-2.4037e-05 -0.047172 -0.152
-6.67693e-05 -0.047172 -0.152
-5.8757e-05 -0.047172 -0.152
-7.47816e-05 -0.0471719 -0.152
0 -0.047172 -0.152
.
.
.

POLYGONS 10364 41456
3 399 214 190
3 50 190 49
3 387 190 212
3 125 212 50
3 2327 2386 1916
3 1503 1916 2045
.
.
.
CELL_DATA 10364
FIELD attributes 1
U 3 10364 float
-0.0382099 -0.00668583 -1.65843
-0.0382099 -0.00668583 -1.65843
-0.0382099 -0.00668583 -1.65843
-0.0382099 -0.00668583 -1.65843
-0.172477 0.0544543 -1.70722
-0.113396 0.0566717 -1.65732
-0.172477 0.0544543 -1.70722
-0.172477 0.0544543 -1.70722
-0.172477 0.0544543 -1.70722
-0.172477 0.0544543 -1.70722
-0.172477 0.0544543 -1.70722
.
.
.

I have gathered that the 'POINTS 5480 float' in the 'U_sampledSurface_sampledSurface.dat' file is the xyz location of each of the points that are being sampled and that the 'POLYGONS 10364 41456' are the numbers of the surfaces being sampled. However, as far as I can gather 'CELL_DATA 10364 FIELD attributes 1 U 3 10364 float' gives me the velocity at each of the points and not the area integrated velocity.

I'm not sure what the 'faceSource.dat' file represents. Any help would be greatly appreciated.

Thank you!
Chenelle is offline   Reply With Quote

Old   October 13, 2015, 01:30
Default
  #11
Senior Member
 
linnemann's Avatar
 
Niels Nielsen
Join Date: Mar 2009
Location: NJ - Denmark
Posts: 471
Rep Power: 16
linnemann will become famous soon enough
Hi

Well it can be a bit misleading.

The reason being that when you sample U it is a vector with three components.

Now I haven't looked at the code that actually writes the data but I'm suspecting that to keep things KISS they keep the vector notation and only write the result to the first part.

So in you output you have

Code:
# Time	sum(magSf)	areaNormalIntegrate(U)
2.010000e+00	2.444231e-05	(1.517481e-07 0.000000e+00 0.000000e+00)
So you actual volume flow is the first part in red.

The VTK data is the raw data and you could take that into paraview and use a calculator to get the massflow.
Chenelle likes this.
__________________
Linnemann

PS. I do not do personal support, so please post in the forums.
linnemann is offline   Reply With Quote

Old   October 13, 2015, 03:35
Default
  #12
New Member
 
Chenelle Basson
Join Date: May 2014
Location: South Africa
Posts: 5
Rep Power: 4
Chenelle is on a distinguished road
Quote:
Originally Posted by linnemann View Post
Hi

Well it can be a bit misleading.

The reason being that when you sample U it is a vector with three components.

Now I haven't looked at the code that actually writes the data but I'm suspecting that to keep things KISS they keep the vector notation and only write the result to the first part.

So in you output you have

Code:
# Time    sum(magSf)    areaNormalIntegrate(U)
2.010000e+00    2.444231e-05    (1.517481e-07 0.000000e+00 0.000000e+00)
So you actual volume flow is the first part in red.

The VTK data is the raw data and you could take that into paraview and use a calculator to get the massflow.
Hi!

Thank you for your prompt response. I suspected that the value in red was the massflow as well, but it is a few magnitudes smaller than the massflow I expect. Do you know what the units are? I was expecting it to be kg/s, maybe I am going wrong there?

Thank you for your help.
Chenelle is offline   Reply With Quote

Old   October 13, 2015, 03:36
Default
  #13
Senior Member
 
linnemann's Avatar
 
Niels Nielsen
Join Date: Mar 2009
Location: NJ - Denmark
Posts: 471
Rep Power: 16
linnemann will become famous soon enough
Hi

If you run a compressible simulation it is kg/s if it is an in-compressible it is m3/s.
Chenelle likes this.
__________________
Linnemann

PS. I do not do personal support, so please post in the forums.
linnemann is offline   Reply With Quote

Old   October 13, 2015, 03:44
Default
  #14
New Member
 
Chenelle Basson
Join Date: May 2014
Location: South Africa
Posts: 5
Rep Power: 4
Chenelle is on a distinguished road
Quote:
Originally Posted by linnemann View Post
Hi

If you run a compressible simulation it is kg/s if it is an in-compressible it is m3/s.
Thank you so much!

I will go see if it that solves the problem.
Chenelle is offline   Reply With Quote

Old   October 21, 2015, 00:02
Default
  #15
New Member
 
Theodore Galanos
Join Date: Mar 2015
Posts: 12
Rep Power: 3
Tellur is on a distinguished road
Hello,

I have been trying to calculate on the fly area average velocities using topoSet and swak4foam in order to acquire the faceZones and then calculate my results.

However, as I posted in another thread, my topoSet created zones are nowhere near my actual surfaces. I wonder if I can use your code in order to do that.

Silly question: you mention the surface cannot expand more than your mesh. Is it ok if it is just a small part of the mesh (e.g. a plane 1.2m vertical from the floor of one room, in one appartment, in one tower, in a small neighbourhood)?

Another silly question: Is the function object in controlDict all I need, that is all you used in your example, or do we need additional files?

And final silly question: Is there a way to use one function object for multiple surfaces? I have around 183 surfaces I have to calculate average velocities for, so I wouldn't want to copy/paste this as many times. Also, I imagine if the above is possible they would all come out in a single file which makes it easier for post-processing.

Thank you so much in advance!

Kind regards,
Theodore.
Tellur 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
[ICEM] surface mesh merging problem everest ANSYS Meshing & Geometry 44 April 14, 2016 06:41
Layers in a curved surface Artex85 Open Source Meshers: Gmsh, Netgen, CGNS, ... 1 December 18, 2011 09:51
Plotting the velocity profile in normal direction along a curved surface StSchiff OpenFOAM 0 December 1, 2011 06:01
sample: free surface & more Phicau OpenFOAM Post-Processing 2 October 11, 2011 10:19
Calculating forces on a non-closed surface ScottN FLUENT 0 March 1, 2011 18:18


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