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

Calculate flux across surface

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

Like Tree1Likes
  • 1 Post By t.oliveira

Reply
 
LinkBack Thread Tools Display Modes
Old   January 19, 2016, 18:56
Default Calculate flux across surface
  #1
Member
 
Thomas Oliveira
Join Date: Apr 2015
Posts: 92
Rep Power: 4
t.oliveira is on a distinguished road
Dear all,

I have got the simulation results for the velocity field along time.

Now I need to compute the integral of U over a plane (that is not a patch) defined by its basePoint and normalVector.

I have exhausted all the possibilities I could imagine using execFlowFunctionObjects and swak4Foam.

Could you please shed some light on how to do it?

Thanks,

Thomas
t.oliveira is offline   Reply With Quote

Old   January 20, 2016, 06:16
Default
  #2
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Delft, Netherlands
Posts: 370
Rep Power: 14
tomf is on a distinguished road
Send a message via MSN to tomf Send a message via Skype™ to tomf
I think this should it be possible with ParaView?
tomf is offline   Reply With Quote

Old   January 20, 2016, 08:04
Default
  #3
Member
 
Thomas Oliveira
Join Date: Apr 2015
Posts: 92
Rep Power: 4
t.oliveira is on a distinguished road
Quote:
Originally Posted by tomf View Post
I think this should it be possible with ParaView?
It probably is. However, AFAIK, the workflow through ParaView is not scalable to many timesteps. Moreover, I would like to repeat that for a series of numerical experiments.
t.oliveira is offline   Reply With Quote

Old   January 20, 2016, 09:05
Default
  #4
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Delft, Netherlands
Posts: 370
Rep Power: 14
tomf is on a distinguished road
Send a message via MSN to tomf Send a message via Skype™ to tomf
Maybe sample could work, probably still requires ParaView, but this may reduce the workload:
Use sample to generate vtk file for each time step only with U variable > Optionally use the foamSequenceVTKFiles script to rename the files in sequenced order > start ParaView > Open the sequenced files > integrateVariables > save Data (all time steps).

This may need some additional work to get everything in one file. I do not know about current OpenFOAM tools that do this right now. If anyone does, feel free to comment.

Regards,
Tom
tomf is offline   Reply With Quote

Old   January 20, 2016, 12:44
Default
  #5
Member
 
Thomas Oliveira
Join Date: Apr 2015
Posts: 92
Rep Power: 4
t.oliveira is on a distinguished road
Quote:
Originally Posted by t.oliveira View Post
I need to compute the integral of U over a plane defined by its basePoint and normalVector. Could you please shed some light on how to do it?
Use the following function object:

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

        enabled         true;
        outputControl   outputTime;
        surfaceFormat   off;

        // 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 sampledSurface: dictionary with a sampledSurface
        //// Note: will not sample surface fields.
        sampledSurfaceDict
        {           
            type            plane;
            basePoint       (8.1e-4 0 0);
            normalVector    (1 0 0);
            interpolate       false;
        }
        operation       areaNormalIntegrate;
        fields
        (
            U
        );
    }
}
I saved it in a file called system/integrateOnSurfaceDict, instead of writing it on the bottom of controlDict, just to keep it more organised.

Use it executing:

Code:
execFlowFunctionObjects -dict system/integrateOnSurfaceDict -noFlow
To find out this solution, I started looking some examples on /src/postProcessing/functionObjects. It is a good starting point.

I tried also using cuttingPlane instead of plane, and interpolate true, and got slightly different results. If I put the plane over a patch, the usage of plane and interpolate false gave the same result as running
Code:
patchIntegrate U <patchName>
Best wishes,

Thomas
rudolf.hellmuth likes this.
t.oliveira is offline   Reply With Quote

Old   January 20, 2016, 12:46
Default
  #6
Member
 
Thomas Oliveira
Join Date: Apr 2015
Posts: 92
Rep Power: 4
t.oliveira is on a distinguished road
Quote:
Originally Posted by tomf View Post
start ParaView > Open the sequenced files > integrateVariables > save Data (all time steps)
Thank you, Tom!
t.oliveira is offline   Reply With Quote

Old   January 21, 2016, 04:23
Default
  #7
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Delft, Netherlands
Posts: 370
Rep Power: 14
tomf is on a distinguished road
Send a message via MSN to tomf Send a message via Skype™ to tomf
Thank you for pointing out the sampledSurface option, was not aware of that. I thought only patches and faceZones were possible.
tomf is offline   Reply With Quote

Old   October 1, 2016, 09:14
Default
  #8
Member
 
A. Min
Join Date: Mar 2015
Posts: 67
Rep Power: 4
alimea is on a distinguished road
Quote:
Originally Posted by t.oliveira View Post
Use the following function object:

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

        enabled         true;
        outputControl   outputTime;
        surfaceFormat   off;

        // 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 sampledSurface: dictionary with a sampledSurface
        //// Note: will not sample surface fields.
        sampledSurfaceDict
        {           
            type            plane;
            basePoint       (8.1e-4 0 0);
            normalVector    (1 0 0);
            interpolate       false;
        }
        operation       areaNormalIntegrate;
        fields
        (
            U
        );
    }
}
I saved it in a file called system/integrateOnSurfaceDict, instead of writing it on the bottom of controlDict, just to keep it more organised.

Use it executing:

Code:
execFlowFunctionObjects -dict system/integrateOnSurfaceDict -noFlow
To find out this solution, I started looking some examples on /src/postProcessing/functionObjects. It is a good starting point.

I tried also using cuttingPlane instead of plane, and interpolate true, and got slightly different results. If I put the plane over a patch, the usage of plane and interpolate false gave the same result as running
Code:
patchIntegrate U <patchName>
Best wishes,

Thomas
Hi
I want to calculate the heat flux over a plane. I have computed gradT before that. Is your code appropriate for my goal?
What about calculation of flux over a cylinder perimeter?
Thanks
alimea is offline   Reply With Quote

Reply

Tags
flux calculation, integrate

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
Symmetry and total surface heat flux CCHunter FLUENT 1 February 26, 2015 17:58
how to Calculate heat flux??? sandip Main CFD Forum 0 December 4, 2009 05:58
Total Heat Transfer Rate & Total Surface Heat Flux Mismatch icaro FLUENT 0 November 24, 2009 08:01
How to specify surface flux of a species? ked FLUENT 16 February 9, 2006 21:14
Total heat transf. rate vs Total surface heat flux Renato Sousa FLUENT 0 August 22, 2005 10:34


All times are GMT -4. The time now is 18:00.