CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Update phi (https://www.cfd-online.com/Forums/openfoam-programming-development/206413-update-phi.html)

kk415 September 6, 2018 06:19

Update phi
 
Hi Foamers,


My main problem is I am interpolating fields(velocity,pressure) from a coarser mesh to finer mesh. The interpolation increases error in continuity equation because the interpolated velocity field is no longer a divergence free field.


Thus, to improve the correction in phi I am updating phi as following:


phis= linearInterpolate (Us) & solidRegions[0].Sf();
forAll( solidRegions[0].owner() , iface ) {
/// Get the left and right cell index
const label& leftCell = solidRegions[0].owner()[iface];
const label& rightCell = solidRegions[0].neighbour()[iface];
phis[iface]=phis[iface]+solidRegions[0].magSf()[iface]*(ps[leftCell]-ps[rightCell]/mag(solidRegions[0].C()[leftCell]-solidRegions[0].C()[rightCell]));
//Info << iface <<endl;
}


Us and ps are interpolated value from another mesh.
This update further increases the error in continuity error :(

My first doubt is whether I am updating in correct face of phi or not? I only want to update the internal faces.


Any help and suggestion would be deeply appreciated.


All times are GMT -4. The time now is 03:09.