diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 17abbc6363da0a3e689afa77a991d73def2cc1e3..6e19f299f0953a59aeb21164edb7a0558c103c98 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -308,6 +308,7 @@ $(ddtSchemes)/backwardDdtScheme/backwardDdtSchemes.C $(ddtSchemes)/boundedBackwardDdtScheme/boundedBackwardDdtScheme.C $(ddtSchemes)/boundedBackwardDdtScheme/boundedBackwardDdtSchemes.C $(ddtSchemes)/CrankNicholsonDdtScheme/CrankNicholsonDdtSchemes.C +$(ddtSchemes)/boundedDdtScheme/boundedDdtSchemes.C d2dt2Schemes = finiteVolume/d2dt2Schemes $(d2dt2Schemes)/d2dt2Scheme/d2dt2Schemes.C diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/boundedDdtScheme/boundedDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/boundedDdtScheme/boundedDdtScheme.C new file mode 100644 index 0000000000000000000000000000000000000000..a89629f6db7f8c92aad3a22bffaeb53babd0575d --- /dev/null +++ b/src/finiteVolume/finiteVolume/ddtSchemes/boundedDdtScheme/boundedDdtScheme.C @@ -0,0 +1,170 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 "boundedDdtScheme.H" +#include "fvcDiv.H" +#include "fvcDdt.H" +#include "fvMatrices.H" +#include "fvmSup.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace fv +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<class Type> +tmp<GeometricField<Type, fvPatchField, volMesh> > +boundedDdtScheme<Type>::fvcDdt +( + const dimensioned<Type>& dt +) +{ + return scheme_().fvcDdt(dt); +} + + +template<class Type> +tmp<GeometricField<Type, fvPatchField, volMesh> > +boundedDdtScheme<Type>::fvcDdt +( + const GeometricField<Type, fvPatchField, volMesh>& vf +) +{ + return scheme_().fvcDdt(vf); +} + + +template<class Type> +tmp<GeometricField<Type, fvPatchField, volMesh> > +boundedDdtScheme<Type>::fvcDdt +( + const dimensionedScalar& rho, + const GeometricField<Type, fvPatchField, volMesh>& vf +) +{ + return scheme_().fvcDdt(rho, vf); +} + + +template<class Type> +tmp<GeometricField<Type, fvPatchField, volMesh> > +boundedDdtScheme<Type>::fvcDdt +( + const volScalarField& rho, + const GeometricField<Type, fvPatchField, volMesh>& vf +) +{ + return scheme_().fvcDdt(rho, vf) - fvc::ddt(rho)*vf; +} + + +template<class Type> +tmp<fvMatrix<Type> > +boundedDdtScheme<Type>::fvmDdt +( + const GeometricField<Type, fvPatchField, volMesh>& vf +) +{ + return scheme_().fvmDdt(vf); +} + + +template<class Type> +tmp<fvMatrix<Type> > +boundedDdtScheme<Type>::fvmDdt +( + const dimensionedScalar& rho, + const GeometricField<Type, fvPatchField, volMesh>& vf +) +{ + return scheme_().fvmDdt(rho, vf); +} + + +template<class Type> +tmp<fvMatrix<Type> > +boundedDdtScheme<Type>::fvmDdt +( + const volScalarField& rho, + const GeometricField<Type, fvPatchField, volMesh>& vf +) +{ + return scheme_().fvmDdt(rho, vf) - fvm::Sp(fvc::ddt(rho), vf); +} + + +template<class Type> +tmp<typename boundedDdtScheme<Type>::fluxFieldType> +boundedDdtScheme<Type>::fvcDdtPhiCorr +( + const volScalarField& rA, + const GeometricField<Type, fvPatchField, volMesh>& U, + const fluxFieldType& phi +) +{ + return scheme_().fvcDdtPhiCorr(rA, U, phi); +} + + +template<class Type> +tmp<typename boundedDdtScheme<Type>::fluxFieldType> +boundedDdtScheme<Type>::fvcDdtPhiCorr +( + const volScalarField& rA, + const volScalarField& rho, + const GeometricField<Type, fvPatchField, volMesh>& U, + const fluxFieldType& phi +) +{ + return scheme_().fvcDdtPhiCorr(rA, rho, U, phi); +} + + +template<class Type> +tmp<surfaceScalarField> boundedDdtScheme<Type>::meshPhi +( + const GeometricField<Type, fvPatchField, volMesh>& vf +) +{ + return scheme_().meshPhi(vf); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/boundedDdtScheme/boundedDdtScheme.H b/src/finiteVolume/finiteVolume/ddtSchemes/boundedDdtScheme/boundedDdtScheme.H new file mode 100644 index 0000000000000000000000000000000000000000..0e5e0831f91140a2fe006a0ccba446289ac80a0e --- /dev/null +++ b/src/finiteVolume/finiteVolume/ddtSchemes/boundedDdtScheme/boundedDdtScheme.H @@ -0,0 +1,207 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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/>. + +Class + Foam::fv::boundedDdtScheme + +Description + Bounded form of the selected ddt scheme. + + Boundedness is achieved by subtracting ddt(phi)*vf or Sp(ddt(rho), vf) + which is non-conservative if ddt(rho) != 0 but conservative otherwise. + + Can be used for the ddt of bounded scalar properties to improve stability + if insufficient convergence of the pressure equation causes temporary + divergence of the flux field. + +SourceFiles + boundedDdtScheme.C + +\*---------------------------------------------------------------------------*/ + +#ifndef boundedDdtScheme_H +#define boundedDdtScheme_H + +#include "ddtScheme.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace fv +{ + +/*---------------------------------------------------------------------------*\ + Class boundedDdtScheme Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class boundedDdtScheme +: + public fv::ddtScheme<Type> +{ + // Private data + + tmp<fv::ddtScheme<Type> > scheme_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + boundedDdtScheme(const boundedDdtScheme&); + + //- Disallow default bitwise assignment + void operator=(const boundedDdtScheme&); + + +public: + + //- Runtime type information + TypeName("bounded"); + + + // Constructors + + //- Construct from mesh and Istream + boundedDdtScheme(const fvMesh& mesh, Istream& is) + : + ddtScheme<Type>(mesh, is), + scheme_ + ( + fv::ddtScheme<Type>::New(mesh, is) + ) + {} + + + // Member Functions + + //- Return mesh reference + const fvMesh& mesh() const + { + return fv::ddtScheme<Type>::mesh(); + } + + tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDdt + ( + const dimensioned<Type>& + ); + + tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDdt + ( + const GeometricField<Type, fvPatchField, volMesh>& + ); + + tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDdt + ( + const dimensionedScalar&, + const GeometricField<Type, fvPatchField, volMesh>& + ); + + tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDdt + ( + const volScalarField&, + const GeometricField<Type, fvPatchField, volMesh>& + ); + + tmp<fvMatrix<Type> > fvmDdt + ( + const GeometricField<Type, fvPatchField, volMesh>& + ); + + tmp<fvMatrix<Type> > fvmDdt + ( + const dimensionedScalar&, + const GeometricField<Type, fvPatchField, volMesh>& + ); + + tmp<fvMatrix<Type> > fvmDdt + ( + const volScalarField&, + const GeometricField<Type, fvPatchField, volMesh>& + ); + + typedef typename ddtScheme<Type>::fluxFieldType fluxFieldType; + + tmp<fluxFieldType> fvcDdtPhiCorr + ( + const volScalarField& rA, + const GeometricField<Type, fvPatchField, volMesh>& U, + const fluxFieldType& phi + ); + + tmp<fluxFieldType> fvcDdtPhiCorr + ( + const volScalarField& rA, + const volScalarField& rho, + const GeometricField<Type, fvPatchField, volMesh>& U, + const fluxFieldType& phi + ); + + tmp<surfaceScalarField> meshPhi + ( + const GeometricField<Type, fvPatchField, volMesh>& + ); +}; + + +template<> +tmp<surfaceScalarField> boundedDdtScheme<scalar>::fvcDdtPhiCorr +( + const volScalarField& rA, + const volScalarField& U, + const surfaceScalarField& phi +); + + +template<> +tmp<surfaceScalarField> boundedDdtScheme<scalar>::fvcDdtPhiCorr +( + const volScalarField& rA, + const volScalarField& rho, + const volScalarField& U, + const surfaceScalarField& phi +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "boundedDdtScheme.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/boundedDdtScheme/boundedDdtSchemes.C b/src/finiteVolume/finiteVolume/ddtSchemes/boundedDdtScheme/boundedDdtSchemes.C new file mode 100644 index 0000000000000000000000000000000000000000..8971a237e58c4db9f8d60c93e648c58ae0a9addb --- /dev/null +++ b/src/finiteVolume/finiteVolume/ddtSchemes/boundedDdtScheme/boundedDdtSchemes.C @@ -0,0 +1,39 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 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 "boundedDdtScheme.H" +#include "fvMesh.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + makeFvDdtScheme(boundedDdtScheme) +} +} + +// ************************************************************************* //