|
[Sponsors] |
December 16, 2019, 02:17 |
Calculating the explicit terms of div(phi,U)
|
#1 |
Member
Join Date: Feb 2014
Posts: 32
Rep Power: 12 |
Hi all,
I am trying to calculate the individual terms of the convection terms in post-process. The convection term is the vector Code:
fvc::div(phi,U). Code:
fvc::div(phi*fvc::interpolate(U)) However, when I use Code:
fvc::grad(phi*fvc::interpolate(U)) the results are not related to anything. Infact even just component 0 is not related to anything. Any ideas? |
|
December 19, 2019, 14:19 |
|
#2 |
Senior Member
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13 |
gradient of a vector is a tensor, not another vector.
__________________
The OpenFOAM community is the biggest contributor to OpenFOAM: User guide/Wiki-1/Wiki-2/Code guide/Code Wiki/Journal Nilsson/Guerrero/Holzinger/Holzmann/Nagy/Santos/Nozaki/Jasak/Primer Governance Bugs/Features: OpenFOAM (ESI-OpenCFD-Trademark) Bugs/Features: FOAM-Extend (Wikki-FSB) Bugs: OpenFOAM.org How to create a MWE New: Forkable OpenFOAM mirror |
|
March 16, 2020, 06:53 |
Solution
|
#3 |
Member
Join Date: Feb 2014
Posts: 32
Rep Power: 12 |
Hi,
I have solved this a while ago but I think its a good thing to post the solution here if somebody will ever need it. So, as HPE mentioned the result is indeed a tensor. This is what we are trying to calculate. That is we want a tensor whose [i.j] item /. As I mentioned, just taking fvc::grad(phi*fvc::interpolate(U)) is erroneous. There are several reasons for that: 1. phi is already multiplied by the surface area of the cell and therefore calling fvc::grad multiplies it twice. 2. There are some correction for the boundary conditions. Using the gauss term we try to calculate the surface integral of /. So the question is now to evaluate these fields on the cell face that is consistent with the way OF calculate the div(phi,U) term. My solution is: First calcualte the tensor terms on the face of each cell. Code:
surfaceTensorField interpolateUU = (phi*mesh.Sf()/mesh.magSf()))*fvc::interpolate(U); Code:
mesh.Sf()/mesh.magSf() Now we need to correct the boundary fields. Code:
forAll(mesh.boundary(), patchi) { auto& boundary_interpolateUU = interpolateU2.boundaryFieldRef()[patchi]; const auto& boundary_phi = phi.boundaryField()[patchi]; const auto& boundary_interpolateU = interpolateU.boundaryField()[patchi]; const auto& boundary_mesh = mesh.boundary()[patchi]; forAll(boundary_mesh, facei) { vector n_inside = -(boundary_mesh.Sf()[facei]/boundary_mesh.magSf()[facei]); tensor tt = (boundary_phi[facei]*n_inside )*boundary_interpolateU[facei]; for (int i=0; i<9;i++) { boundary_interpolateUU[facei].component(i) = tt.component(i); } } } fvc::surfaceIntegrate(interpolateUU); |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
rotational and inviscid | Mike | Main CFD Forum | 40 | November 9, 2023 07:03 |
Implicit vs Explicit | Houthuys | Main CFD Forum | 15 | February 3, 2017 12:17 |
Explicit filtering in LES | TJ | Main CFD Forum | 85 | November 30, 2016 06:22 |
The terms that should be treated implicitly in LES | ben | Main CFD Forum | 3 | January 28, 2005 04:32 |
K-Epsilon model? | Brindaban Ghosh | Main CFD Forum | 2 | June 24, 2000 05:22 |