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

Computing the flux at an arbitrary 2D surface

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 7, 2018, 14:23
Default Computing the flux at an arbitrary 2D surface
  #1
New Member
 
Andy
Join Date: Aug 2015
Posts: 8
Rep Power: 7
andy_pr is on a distinguished road
Hello,

I am trying to compute the massflow rate through an arbitrary surface (not necessarily a cell face). I had a look at this post:

Write cells and data intersecting a plane cuttingPlane

And tried to apply it to my case, which resulted in this:

1) Isolate the surface where I want to compute the mass flow
2) Reconstruct the flux at the surface using the surfaceScalarField values
3) Add the fluxes up
4) Print the result to the terminal

I've checked the area from (1) and printing is ok (4), so I guess my problem could be in the reconstruction (2) or the addition (3), but I'm not sure.

If this is true, essentially my question boils down to "how to reconstruct fluxes at an arbitrary surface and add them up?"

So, this is the code I think is wrong (I have to add up the flux from phases 1 and 2) - it's also in solver.C

Code:
// 1. Isolate the surface where I want to compute the mass flow

point pnt1(-0.007, 0.05, 0.0);
point pnt2(0.007, 0.05, 0.01);
point pnt3(0.007, 0.05, 0.0);
plane pl1(pnt1, pnt2, pnt3);

const keyType nameHere = keyType("orifice-cells");
sampledPlane smpPl("smpPl",mesh,pl1,nameHere, true);
smpPl.update();

// 2. In time loop: Reconstruct the flux at the surface

while(runTime.run())
{
 .....

volScalarField phi_reconstruct1 = fvc::reconstructMag(phi1);
scalarField slicedDesiredField1 = smpPl.sample(phi_reconstruct1);
volScalarField phi_reconstruct2 = fvc::reconstructMag(phi2);
scalarField slicedDesiredField2 = smpPl.sample(phi_reconstruct2);

scalar area_phantom = gSum(smpPl.magSf());

// 3. Add the fluxes up 
        
scalar sumField_phantom_phi1 = 0;
scalar sumField_phantom_phi2 = 0;

if (area_phantom > 0)
{
    sumField_phantom_phi1 = gSum(slicedDesiredField1);
    sumField_phantom_phi2 = gSum(slicedDesiredField2);
}

// 4. Print the result to the terminal

Info<< "Area (m^2) = "
<< area_phantom
<< " \n" << endl;

Info << " Massflow (g/s) = "
<< abs(1000*2900*sumField_phantom_phi1 + 1000*1.3*sumField_phantom_phi2) 
<< " \n" << endl;
}
I'm comparing the reconstructed massflows with the standard topoSet approach, where I sum the values at a faceZone using the dictionaries.

However, the result from the reconstructed phi is 18,536,101 g/s at t=6s, (reconstruct3.png) whilst the (correct) approach using topoSetDict gives 97.87 g/s (topoSet3.png), however the trends are similar.

Does anyone know where I've gone wrong?

Kind regards,

andypr
Attached Images
File Type: png topoSet3.png (12.1 KB, 10 views)
File Type: png reconstruct3.png (16.3 KB, 8 views)
Attached Files
File Type: c solver.C (5.4 KB, 8 views)

Last edited by andy_pr; August 8, 2018 at 08:21.
andy_pr is offline   Reply With Quote

Reply

Tags
arbitrary 2d clip, flux, phi, reconstruction

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
[ICEM] Problems with coedge curves and surfaces tommymoose ANSYS Meshing & Geometry 6 December 1, 2020 11:12
Total heat transf. rate vs Total surface heat flux Renato Sousa FLUENT 1 April 14, 2020 03:27
How to specify surface flux of a species? ked FLUENT 17 November 12, 2017 16:30
monitoring dynamic heat flux through a surface abdnakhi FLUENT 0 August 15, 2005 09:57
Radiation flux to the wall surface Jason Phoenics 1 May 26, 2004 01:13


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