|
[Sponsors] |
Calculating fvc::grad as a surfaceScalarField |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 20, 2019, 02:56 |
Calculating fvc::grad as a surfaceScalarField
|
#1 |
Member
benoit favier
Join Date: Jun 2017
Posts: 64
Rep Power: 8 |
Hello,
I am trying to modify reactingFoam from openfoam 6.0 so that i can save the flux of species. I created a volScalarField to save this value Code:
volVectorField flux_N2 ( IOobject ( "flux_N2", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), mesh, dimensionedVector("flux_N2_0", dimensionSet(1,-2,-1,0,0,0,0), Foam::vector(0,0,0)) ); Code:
//Saving Zn flux if (Yi.name() == "N2") { flux_Zn = rho*U*Yi - rho*D_i*fvc::grad(Yi)(); } |
|
March 20, 2019, 03:54 |
|
#2 |
Senior Member
Santiago Lopez Castano
Join Date: Nov 2012
Posts: 354
Rep Power: 15 |
Have you tried snGrad?
|
|
March 20, 2019, 07:42 |
|
#3 |
Member
benoit favier
Join Date: Jun 2017
Posts: 64
Rep Power: 8 |
Hello, thank you for your help.
Unfortunately, it seems that snGrad returns a surfaceScalarField and not a surfaceVectorField. It returns a scalar because it seems to perform a dot product of the gradient with the normal to the cell. |
|
March 21, 2019, 04:42 |
|
#5 | |
Senior Member
Santiago Lopez Castano
Join Date: Nov 2012
Posts: 354
Rep Power: 15 |
Quote:
If you want the gradient at the face centre, calculate it using fvc::grad and then interpolate the vector to the face centre. I dont see other way that doesnt involve creating a dual mesh |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Questions on dynamicTopoFvMesh | danvica | OpenFOAM Running, Solving & CFD | 80 | April 16, 2019 16:58 |
Long output in terminal. | ssa_cfd | OpenFOAM Running, Solving & CFD | 1 | March 18, 2019 05:25 |
DPMFoam - Serious Error --particle-laden flow in simple geometric config | benz25 | OpenFOAM Running, Solving & CFD | 27 | December 19, 2017 20:47 |
''unknown radialModelType type Gidaspow'' PROBLEM WITH THE BED TUTORIAL | AndoniBM | OpenFOAM Running, Solving & CFD | 2 | March 25, 2015 18:44 |
How to update polyPatchbs localPoints | liu | OpenFOAM Running, Solving & CFD | 6 | December 30, 2005 17:27 |