|
[Sponsors] |
January 28, 2019, 15:51 |
fvc::interpolate(rAU) at boundary faces
|
#1 |
New Member
Jesper R. K. Qwist
Join Date: Dec 2017
Posts: 22
Rep Power: 9 |
Hi everyone,
I am currently trying to understand how OpenFOAM interpolates the cell centred field "rAU" to the cell face centres, whereby we get "rAUf". rAU is 1/A0, where A0 is the diagonal elements from the implicit part of the discretisation of the convective and diffusive terms in the momentum equation. I know that for internal faces at linear interpolation is performed between the two cell centres sharing the face. Does anyone know how the interpolation is performed at the boundary faces? Best Regards and Thanks in advance, JRKQ. |
|
January 28, 2019, 16:54 |
|
#2 | |
Senior Member
Andrew Somorjai
Join Date: May 2013
Posts: 175
Rep Power: 13 |
Quote:
Code:
surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask)); volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("rhorAUf", faceMask*fvc::interpolate(rho*rAU)); volVectorField HbyA("HbyA", U); HbyA = constrainHbyA(cellMask*rAU*UEqn.H(), U, p); This might help What does fvc::interpolate(U) & mesh.Sf() stand for? |
||
January 28, 2019, 19:47 |
|
#3 |
Senior Member
Andrew Somorjai
Join Date: May 2013
Posts: 175
Rep Power: 13 |
Might be wrong but this seems like the header file surfaceInterpolate.H
Code:
/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. InNamespace Foam::fvc Description Surface Interpolation SourceFiles surfaceInterpolate.C \*---------------------------------------------------------------------------*/ #ifndef surfaceInterpolate_H #define surfaceInterpolate_H #include "tmp.H" #include "volFieldsFwd.H" #include "surfaceFieldsFwd.H" #include "surfaceInterpolationScheme.H" #include "one.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\ Namespace fvc functions Declaration \*---------------------------------------------------------------------------*/ namespace fvc { //- Return weighting factors for scheme given from Istream template<class Type> static tmp<surfaceInterpolationScheme<Type>> scheme ( const surfaceScalarField& faceFlux, Istream& schemeData ); //- Return weighting factors for scheme given by name in dictionary template<class Type> static tmp<surfaceInterpolationScheme<Type>> scheme ( const surfaceScalarField& faceFlux, const word& name ); //- Return weighting factors for scheme given from Istream template<class Type> static tmp<surfaceInterpolationScheme<Type>> scheme ( const fvMesh& mesh, Istream& schemeData ); //- Return weighting factors for scheme given by name in dictionary template<class Type> static tmp<surfaceInterpolationScheme<Type>> scheme ( const fvMesh& mesh, const word& name ); //- Interpolate field onto faces using scheme given by Istream template<class Type> static tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> interpolate ( const GeometricField<Type, fvPatchField, volMesh>& tvf, const surfaceScalarField& faceFlux, Istream& schemeData ); //- Interpolate field onto faces using scheme given by name in fvSchemes template<class Type> static tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> interpolate ( const GeometricField<Type, fvPatchField, volMesh>& tvf, const surfaceScalarField& faceFlux, const word& name ); //- Interpolate field onto faces using scheme given by name in fvSchemes template<class Type> static tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> interpolate ( const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvf, const surfaceScalarField& faceFlux, const word& name ); //- Interpolate field onto faces using scheme given by name in fvSchemes template<class Type> static tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> interpolate ( const GeometricField<Type, fvPatchField, volMesh>& tvf, const tmp<surfaceScalarField>& faceFlux, const word& name ); //- Interpolate field onto faces using scheme given by name in fvSchemes template<class Type> static tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> interpolate ( const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvf, const tmp<surfaceScalarField>& faceFlux, const word& name ); //- Interpolate field onto faces using scheme given by Istream template<class Type> static tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> interpolate ( const GeometricField<Type, fvPatchField, volMesh>& tvf, Istream& schemeData ); //- Interpolate field onto faces using scheme given by name in fvSchemes template<class Type> static tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> interpolate ( const GeometricField<Type, fvPatchField, volMesh>& tvf, const word& name ); //- Interpolate field onto faces using scheme given by name in fvSchemes template<class Type> static tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> interpolate ( const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvf, const word& name ); //- Interpolate field onto faces using 'interpolate(<name>)' template<class Type> static tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> interpolate ( const GeometricField<Type, fvPatchField, volMesh>& tvf ); //- Interpolate tmp field onto faces using 'interpolate(<name>)' template<class Type> static tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> interpolate ( const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvf ); //- Interpolate boundary field onto faces (simply a type conversion) template<class Type> static tmp<FieldField<fvsPatchField, Type>> interpolate ( const FieldField<fvPatchField, Type>& fvpff ); //- Interpolate boundary field onto faces (simply a type conversion) template<class Type> static tmp<FieldField<fvsPatchField, Type>> interpolate ( const tmp<FieldField<fvPatchField, Type>>& tfvpff ); //- Interpolate 'one' returning 'one' inline one interpolate(const one&) { return one(); } //- Interpolate field onto faces // and 'dot' with given surfaceVectorField Sf template<class Type> static tmp < GeometricField < typename innerProduct<vector, Type>::type, fvsPatchField, surfaceMesh > > dotInterpolate ( const surfaceVectorField& Sf, const GeometricField<Type, fvPatchField, volMesh>& tvf ); //- Interpolate tmp field onto faces // and 'dot' with given surfaceVectorField Sf template<class Type> static tmp < GeometricField < typename innerProduct<vector, Type>::type, fvsPatchField, surfaceMesh > > dotInterpolate ( const surfaceVectorField& Sf, const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvf ); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository #include "surfaceInterpolate.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif // ************************************************************************* // And here's the source surfaceInterpolate.C Code:
/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. \*---------------------------------------------------------------------------*/ #include "surfaceInterpolate.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template<class Type> Foam::tmp<Foam::surfaceInterpolationScheme<Type>> Foam::fvc::scheme ( const surfaceScalarField& faceFlux, Istream& streamData ) { return surfaceInterpolationScheme<Type>::New ( faceFlux.mesh(), faceFlux, streamData ); } template<class Type> Foam::tmp<Foam::surfaceInterpolationScheme<Type>> Foam::fvc::scheme ( const surfaceScalarField& faceFlux, const word& name ) { return surfaceInterpolationScheme<Type>::New ( faceFlux.mesh(), faceFlux, faceFlux.mesh().interpolationScheme(name) ); } template<class Type> Foam::tmp<Foam::surfaceInterpolationScheme<Type>> Foam::fvc::scheme ( const fvMesh& mesh, Istream& streamData ) { return surfaceInterpolationScheme<Type>::New ( mesh, streamData ); } template<class Type> Foam::tmp<Foam::surfaceInterpolationScheme<Type>> Foam::fvc::scheme ( const fvMesh& mesh, const word& name ) { return surfaceInterpolationScheme<Type>::New ( mesh, mesh.interpolationScheme(name) ); } template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>> Foam::fvc::interpolate ( const GeometricField<Type, fvPatchField, volMesh>& vf, const surfaceScalarField& faceFlux, Istream& schemeData ) { if (surfaceInterpolation::debug) { InfoInFunction << "interpolating GeometricField<Type, fvPatchField, volMesh> " << vf.name() << endl; } return scheme<Type>(faceFlux, schemeData)().interpolate(vf); } template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>> Foam::fvc::interpolate ( const GeometricField<Type, fvPatchField, volMesh>& vf, const surfaceScalarField& faceFlux, const word& name ) { if (surfaceInterpolation::debug) { InfoInFunction << "interpolating GeometricField<Type, fvPatchField, volMesh> " << vf.name() << " using " << name << endl; } return scheme<Type>(faceFlux, name)().interpolate(vf); } template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>> Foam::fvc::interpolate ( const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvf, const surfaceScalarField& faceFlux, const word& name ) { tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tsf = interpolate(tvf(), faceFlux, name); tvf.clear(); return tsf; } template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>> Foam::fvc::interpolate ( const GeometricField<Type, fvPatchField, volMesh>& vf, const tmp<surfaceScalarField>& tFaceFlux, const word& name ) { tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tsf = interpolate(vf, tFaceFlux(), name); tFaceFlux.clear(); return tsf; } template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>> Foam::fvc::interpolate ( const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvf, const tmp<surfaceScalarField>& tFaceFlux, const word& name ) { tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tsf = interpolate(tvf(), tFaceFlux(), name); tvf.clear(); tFaceFlux.clear(); return tsf; } template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>> Foam::fvc::interpolate ( const GeometricField<Type, fvPatchField, volMesh>& vf, Istream& schemeData ) { if (surfaceInterpolation::debug) { InfoInFunction << "interpolating GeometricField<Type, fvPatchField, volMesh> " << vf.name() << endl; } return scheme<Type>(vf.mesh(), schemeData)().interpolate(vf); } template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>> Foam::fvc::interpolate ( const GeometricField<Type, fvPatchField, volMesh>& vf, const word& name ) { if (surfaceInterpolation::debug) { InfoInFunction << "interpolating GeometricField<Type, fvPatchField, volMesh> " << vf.name() << " using " << name << endl; } return scheme<Type>(vf.mesh(), name)().interpolate(vf); } template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>> Foam::fvc::interpolate ( const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvf, const word& name ) { tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tsf = interpolate(tvf(), name); tvf.clear(); return tsf; } template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>> Foam::fvc::interpolate ( const GeometricField<Type, fvPatchField, volMesh>& vf ) { if (surfaceInterpolation::debug) { InfoInFunction << "interpolating GeometricField<Type, fvPatchField, volMesh> " << vf.name() << " using run-time selected scheme" << endl; } return interpolate(vf, "interpolate(" + vf.name() + ')'); } template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>> Foam::fvc::interpolate ( const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvf ) { tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tsf = interpolate(tvf()); tvf.clear(); return tsf; } template<class Type> Foam::tmp<Foam::FieldField<Foam::fvsPatchField, Type>> Foam::fvc::interpolate ( const FieldField<fvPatchField, Type>& fvpff ) { FieldField<fvsPatchField, Type>* fvspffPtr ( new FieldField<fvsPatchField, Type>(fvpff.size()) ); forAll(*fvspffPtr, patchi) { fvspffPtr->set ( patchi, fvsPatchField<Type>::NewCalculatedType(fvpff[patchi].patch()).ptr() ); (*fvspffPtr)[patchi] = fvpff[patchi]; } return tmp<FieldField<fvsPatchField, Type>>(fvspffPtr); } template<class Type> Foam::tmp<Foam::FieldField<Foam::fvsPatchField, Type>> Foam::fvc::interpolate ( const tmp<FieldField<fvPatchField, Type>>& tfvpff ) { tmp<FieldField<fvsPatchField, Type>> tfvspff = interpolate(tfvpff()); tfvpff.clear(); return tfvspff; } template<class Type> Foam::tmp < Foam::GeometricField < typename Foam::innerProduct<Foam::vector, Type>::type, Foam::fvsPatchField, Foam::surfaceMesh > > Foam::fvc::dotInterpolate ( const surfaceVectorField& Sf, const GeometricField<Type, fvPatchField, volMesh>& vf ) { if (surfaceInterpolation::debug) { InfoInFunction << "interpolating GeometricField<Type, fvPatchField, volMesh> " << vf.name() << " using run-time selected scheme" << endl; } return scheme<Type> ( vf.mesh(), "dotInterpolate(" + Sf.name() + ',' + vf.name() + ')' )().dotInterpolate(Sf, vf); } template<class Type> Foam::tmp < Foam::GeometricField < typename Foam::innerProduct<Foam::vector, Type>::type, Foam::fvsPatchField, Foam::surfaceMesh > > Foam::fvc::dotInterpolate ( const surfaceVectorField& Sf, const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvf ) { tmp < GeometricField < typename Foam::innerProduct<Foam::vector, Type>::type, fvsPatchField, surfaceMesh > > tsf = dotInterpolate(Sf, tvf()); tvf.clear(); return tsf; } https://www.openfoam.com/documentati...8C_source.html Last edited by massive_turbulence; January 28, 2019 at 19:50. Reason: Added more details |
|
January 30, 2019, 04:53 |
|
#4 |
New Member
Jesper R. K. Qwist
Join Date: Dec 2017
Posts: 22
Rep Power: 9 |
Hi massive_turbulence,
Thank you for your reply. To my understanding fvc::interpolate(U) & mesh.Sf() is the dot product between the surface normal area vector to the face in question and the cell centred velocity field interpolated to the cell face in question. Maybe I posted the question in the wrong section. I am interested in a theoretical explanation for how the linear interpolation is carried out at the boundaries of the domain, and not how it is coded in OpenFOAM. I have done some more research on this and I think have found a source to get the information I seek, which is the book: Moukalled, Mangani, Darwish - 2016 - The finite volume method in computational fluid dynamics In Section 15.6, the book writes about the boundary conditions in relation to the Rhie-Chow interpolation, both for boundary cells and internal cells. |
|
January 30, 2019, 08:15 |
|
#5 | |
Senior Member
Andrew Somorjai
Join Date: May 2013
Posts: 175
Rep Power: 13 |
Quote:
Try reading this https://openfoamwiki.net/index.php/B...sinesqPisoFoam There's some info on how things are done, but they do gloss over Rhie-Chow interpolation without details. Otherwise there are lots of papers online you can search for or maybe someone will give a tutorial here eventually. |
||
January 30, 2019, 09:55 |
|
#6 |
New Member
Jesper R. K. Qwist
Join Date: Dec 2017
Posts: 22
Rep Power: 9 |
Thank you for the link, it is very useful. I will definitely save that
I agree, it is hard to find a presentation of the Rhie-Chow interpolation, which is easily understood. In my opinion the explanations are often made with a large number of introduced variables to shorten the presentation, which ends up in a nightmare of notation to keep track of. And one more thing I rarely find that the authors using the Rhie-Chow interpolation describes the boundary conditions for the method, even though this is a critical part of CFD. I hope that I can get back to this post with a detailed explanation of the Rhie-Chow interpolation with less notation and detailed comments on boundary conditions. Thank you for your suggestions and comments |
|
Tags |
boundary, fvc::interpolate, interpolate, rau, rauf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wind turbine simulation | Saturn | CFX | 60 | July 17, 2024 06:45 |
[snappyHexMesh] Help with Snappy: no layers growing | GianF | OpenFOAM Meshing & Mesh Conversion | 2 | September 23, 2020 09:26 |
[snappyHexMesh] sHM layer process keeps getting killed | MBttR | OpenFOAM Meshing & Mesh Conversion | 4 | August 15, 2016 04:21 |
[OpenFOAM.org] OF2.3.1 + OS13.2 - Trying to use the dummy Pstream library | aylalisa | OpenFOAM Installation | 23 | June 15, 2015 15:49 |
Radiation interface | hinca | CFX | 15 | January 26, 2014 18:11 |