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

Flux calculation in electrostaticFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By syavash

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 15, 2020, 18:06
Default Flux calculation in electrostaticFoam
  #1
Senior Member
 
Syavash Asgari
Join Date: Apr 2010
Posts: 473
Rep Power: 18
syavash is on a distinguished road
Dear Foamers,

I see that in electrostaticFoam solver, flux has been calculated as follows:

Code:
rhoFlux = -k*mesh.magSf()*fvc::snGrad(phi);
where k in some scalar and phi is the electric potential:

Code:
        solve
        (
            fvm::laplacian(phi) + rho/epsilon0
        );
Accordingly, the electric field vector can be obtained in the following way:

Code:
volVectorField E = -fvc::grad(phi)
Now, my question: is it correct to calculate the flux using the following relation:


Code:
rhoFlux = fvc::interpolate(-k*E) & mesh.Sf();
The line above is consistent with the flux calculation in pimpleFoam for instance, but I get divergence when I apply it in my code instead of the first expression. Is there a significant difference between these two methods?

I appreciate any help

Kind regards,
syavash
tonnykz likes this.
syavash is offline   Reply With Quote

Old   June 28, 2020, 20:50
Default
  #2
New Member
 
Join Date: Jun 2020
Location: UK
Posts: 22
Rep Power: 5
Rango is on a distinguished road
Hi,

The resaon for solver crash using your approach is that there is a small sign typo in your flux equation. The correct form of the equation would be:
Code:
rhoFlux = fvc::interpolate(k*E) & mesh.Sf();
Even though these two approaches may seem the same, they may lead to different results on numerical level. In your proposed approach, you introduce an extra source of error due to (unnecessary) interpolation of a field (here E), while in the original approach the gradient is computed directly on mesh faces using "surface-normal gradient" operator, "snGrad".

In this case you may get away with the introduced gradient error, but in general it can result in non-physical "checkerboard" effects.

Cheers
Rango is offline   Reply With Quote

Reply

Tags
electrostaticfoam, rhoflux


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
Calculation of spectral transfer flux T(k) gharek Main CFD Forum 3 August 1, 2017 12:51
calculation of wall heat flux in CHT richard CFX 1 July 23, 2009 09:00
Flux calculation across a boundary hirokata Siemens 3 July 4, 2008 00:25
Warning 097- AB Siemens 6 November 15, 2004 04:41
Turbulence Model and Accuracy of convective flux calculation Lokesh Agrawal Main CFD Forum 1 November 14, 1998 23:24


All times are GMT -4. The time now is 22:44.