ENH: finiteArea - integrated d2dt2 scheme from Alexander Kabat vel Job

This commit is contained in:
Andrew Heather
2018-04-20 15:04:47 +01:00
parent 4a2afb85d6
commit 694004ad41
13 changed files with 1647 additions and 0 deletions

View File

@ -92,6 +92,10 @@ $(ddtSchemes)/EulerFaDdtScheme/EulerFaDdtSchemes.C
$(ddtSchemes)/backwardFaDdtScheme/backwardFaDdtSchemes.C
$(ddtSchemes)/boundedBackwardFaDdtScheme/boundedBackwardFaDdtScheme.C
d2dt2Schemes = finiteArea/d2dt2Schemes
$(d2dt2Schemes)/faD2dt2Scheme/faD2dt2Schemes.C
$(d2dt2Schemes)/EulerFaD2dt2Scheme/EulerFaD2dt2Schemes.C
divSchemes = finiteArea/divSchemes
finiteArea/fam/vectorFamDiv.C
$(divSchemes)/faDivScheme/faDivSchemes.C

View File

@ -0,0 +1,627 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2017 Volkswagen AG
-------------------------------------------------------------------------------
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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "EulerFaD2dt2Scheme.H"
#include "facDiv.H"
#include "faMatrices.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fa
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
scalar EulerFaD2dt2Scheme<Type>::deltaT_() const
{
return mesh().time().deltaT().value();
}
template<class Type>
scalar EulerFaD2dt2Scheme<Type>::deltaT0_() const
{
return mesh().time().deltaT0().value();
}
template<class Type>
tmp<GeometricField<Type, faPatchField, areaMesh>>
EulerFaD2dt2Scheme<Type>::facD2dt2
(
const dimensioned<Type> dt
)
{
scalar deltaT = deltaT_();
scalar deltaT0 = deltaT0_();
dimensionedScalar rDeltaT2 =
4.0/sqr(mesh().time().deltaT() + mesh().time().deltaT0());
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
IOobject d2dt2IOobject
(
"d2dt2("+dt.name()+')',
mesh()().time().timeName(),
mesh()(),
IOobject::NO_READ,
IOobject::NO_WRITE
);
if (mesh().moving())
{
scalar halfRdeltaT2 = rDeltaT2.value()/2.0;
scalarField SS0 = mesh().S() + mesh().S0();
scalarField S0S00 = mesh().S0() + mesh().S00();
tmp<GeometricField<Type, faPatchField, areaMesh> > tdt2dt2
(
new GeometricField<Type, faPatchField, areaMesh>
(
d2dt2IOobject,
mesh(),
dimensioned<Type>
(
"0",
dt.dimensions()/dimTime/dimTime,
pTraits<Type>::zero
)
)
);
tdt2dt2.ref().primitiveFieldRef() =
halfRdeltaT2*dt.value()
*(coefft*SS0 - (coefft*SS0 + coefft00*S0S00) + coefft00*S0S00)
/mesh().S();
return tdt2dt2;
}
else
{
return tmp<GeometricField<Type, faPatchField, areaMesh> >
(
new GeometricField<Type, faPatchField, areaMesh>
(
d2dt2IOobject,
mesh(),
dimensioned<Type>
(
"0",
dt.dimensions()/dimTime/dimTime,
pTraits<Type>::zero
),
calculatedFaPatchField<Type>::typeName
)
);
}
}
template<class Type>
tmp<GeometricField<Type, faPatchField, areaMesh>>
EulerFaD2dt2Scheme<Type>::facD2dt2
(
const GeometricField<Type, faPatchField, areaMesh>& vf
)
{
dimensionedScalar rDeltaT2 =
4.0/sqr(mesh().time().deltaT() + mesh().time().deltaT0());
IOobject d2dt2IOobject
(
"d2dt2("+vf.name()+')',
mesh()().time().timeName(),
mesh()(),
IOobject::NO_READ,
IOobject::NO_WRITE
);
scalar deltaT = deltaT_();
scalar deltaT0 = deltaT0_();
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
scalar coefft0 = coefft + coefft00;
if (mesh().moving())
{
scalar halfRdeltaT2 = rDeltaT2.value()/2.0;
scalarField SS0 = mesh().S() + mesh().S0();
scalarField S0S00 = mesh().S0() + mesh().S00();
return tmp<GeometricField<Type, faPatchField, areaMesh> >
(
new GeometricField<Type, faPatchField, areaMesh>
(
d2dt2IOobject,
mesh(),
rDeltaT2.dimensions()*vf.dimensions(),
halfRdeltaT2*
(
coefft*SS0*vf.primitiveField()
- (coefft*SS0 + coefft00*S0S00)
*vf.oldTime().primitiveField()
+ (coefft00*S0S00)*vf.oldTime().oldTime().primitiveField()
)/mesh().S(),
rDeltaT2.value()*
(
coefft*vf.boundaryField()
- coefft0*vf.oldTime().boundaryField()
+ coefft00*vf.oldTime().oldTime().boundaryField()
)
)
);
}
else
{
return tmp<GeometricField<Type, faPatchField, areaMesh> >
(
new GeometricField<Type, faPatchField, areaMesh>
(
d2dt2IOobject,
rDeltaT2*
(
coefft*vf
- coefft0*vf.oldTime()
+ coefft00*vf.oldTime().oldTime()
)
)
);
}
}
template<class Type>
tmp<GeometricField<Type, faPatchField, areaMesh>>
EulerFaD2dt2Scheme<Type>::facD2dt2
(
const dimensionedScalar& rho,
const GeometricField<Type, faPatchField, areaMesh>& vf
)
{
dimensionedScalar rDeltaT2 =
4.0/sqr(mesh().time().deltaT() + mesh().time().deltaT0());
IOobject d2dt2IOobject
(
"d2dt2("+rho.name()+','+vf.name()+')',
mesh()().time().timeName(),
mesh()(),
IOobject::NO_READ,
IOobject::NO_WRITE
);
scalar deltaT = deltaT_();
scalar deltaT0 = deltaT0_();
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
scalar coefft0 = coefft + coefft00;
if (mesh().moving())
{
scalar halfRdeltaT2 = 0.5*rDeltaT2.value();
scalarField SS0rhoRho0 =
(mesh().S() + mesh().S0())
*rho.value();
scalarField S0S00rho0Rho00 =
(mesh().S0() + mesh().S00())
*rho.value();
return tmp<GeometricField<Type, faPatchField, areaMesh> >
(
new GeometricField<Type, faPatchField, areaMesh>
(
d2dt2IOobject,
mesh(),
rDeltaT2.dimensions()*rho.dimensions()*vf.dimensions(),
halfRdeltaT2*
(
coefft*SS0rhoRho0*vf.primitiveField()
- (coefft*SS0rhoRho0 + coefft00*S0S00rho0Rho00)
*vf.oldTime().primitiveField()
+ (coefft00*S0S00rho0Rho00)
*vf.oldTime().oldTime().primitiveField()
)/mesh().S(),
rDeltaT2.value()*rho.value()*
(
coefft*vf.boundaryField()
- coefft0*vf.oldTime().boundaryField()
+ coefft00*vf.oldTime().oldTime().boundaryField()
)
)
);
}
else
{
return tmp<GeometricField<Type, faPatchField, areaMesh> >
(
new GeometricField<Type, faPatchField, areaMesh>
(
d2dt2IOobject,
rDeltaT2 * rho.value() *
(
coefft*vf
- coefft0*vf.oldTime()
+ coefft00*vf.oldTime().oldTime()
)
)
);
}
}
template<class Type>
tmp<GeometricField<Type, faPatchField, areaMesh>>
EulerFaD2dt2Scheme<Type>::facD2dt2
(
const areaScalarField& rho,
const GeometricField<Type, faPatchField, areaMesh>& vf
)
{
dimensionedScalar rDeltaT2 =
4.0/sqr(mesh().time().deltaT() + mesh().time().deltaT0());
IOobject d2dt2IOobject
(
"d2dt2("+rho.name()+','+vf.name()+')',
mesh()().time().timeName(),
mesh()(),
IOobject::NO_READ,
IOobject::NO_WRITE
);
scalar deltaT = deltaT_();
scalar deltaT0 = deltaT0_();
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
if (mesh().moving())
{
scalar halfRdeltaT2 = 0.5*rDeltaT2.value();
scalar quarterRdeltaT2 = 0.25*rDeltaT2.value();
scalarField SS0rhoRho0
(
(mesh().S() + mesh().S0())
*(rho.primitiveField() + rho.oldTime().primitiveField())
);
scalarField S0S00rho0Rho00
(
(mesh().S0() + mesh().S00())
*(
rho.oldTime().primitiveField()
+ rho.oldTime().oldTime().primitiveField()
)
);
return tmp<GeometricField<Type, faPatchField, areaMesh> >
(
new GeometricField<Type, faPatchField, areaMesh>
(
d2dt2IOobject,
mesh(),
rDeltaT2.dimensions()*rho.dimensions()*vf.dimensions(),
quarterRdeltaT2*
(
coefft*SS0rhoRho0*vf.primitiveField()
- (coefft*SS0rhoRho0 + coefft00*S0S00rho0Rho00)
*vf.oldTime().primitiveField()
+ (coefft00*S0S00rho0Rho00)
*vf.oldTime().oldTime().primitiveField()
)/mesh().S(),
halfRdeltaT2*
(
coefft
*(rho.boundaryField() + rho.oldTime().boundaryField())
*vf.boundaryField()
- (
coefft
*(
rho.boundaryField()
+ rho.oldTime().boundaryField()
)
+ coefft00
*(
rho.oldTime().boundaryField()
+ rho.oldTime().oldTime().boundaryField()
)
)*vf.oldTime().boundaryField()
+ coefft00
*(
rho.oldTime().boundaryField()
+ rho.oldTime().oldTime().boundaryField()
)*vf.oldTime().oldTime().boundaryField()
)
)
);
}
else
{
dimensionedScalar halfRdeltaT2 = 0.5*rDeltaT2;
areaScalarField rhoRho0(rho + rho.oldTime());
areaScalarField rho0Rho00(rho.oldTime() + rho.oldTime().oldTime());
return tmp<GeometricField<Type, faPatchField, areaMesh> >
(
new GeometricField<Type, faPatchField, areaMesh>
(
d2dt2IOobject,
halfRdeltaT2*
(
coefft*rhoRho0*vf
- (coefft*rhoRho0 + coefft00*rho0Rho00)*vf.oldTime()
+ coefft00*rho0Rho00*vf.oldTime().oldTime()
)
)
);
}
}
template<class Type>
tmp<faMatrix<Type>>
EulerFaD2dt2Scheme<Type>::famD2dt2
(
const GeometricField<Type, faPatchField, areaMesh>& vf
)
{
tmp<faMatrix<Type> > tfam
(
new faMatrix<Type>
(
vf,
vf.dimensions()*dimArea/dimTime/dimTime
)
);
faMatrix<Type>& fam = tfam.ref();
scalar deltaT = deltaT_();
scalar deltaT0 = deltaT0_();
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
scalar coefft0 = coefft + coefft00;
scalar rDeltaT2 = 4.0/sqr(deltaT + deltaT0);
if (mesh().moving())
{
scalar halfRdeltaT2 = rDeltaT2/2.0;
scalarField SS0(mesh().S() + mesh().S0());
scalarField S0S00(mesh().S0() + mesh().S00());
fam.diag() = (coefft*halfRdeltaT2)*SS0;
fam.source() = halfRdeltaT2*
(
(coefft*SS0 + coefft00*S0S00)
*vf.oldTime().primitiveField()
- (coefft00*S0S00)*vf.oldTime().oldTime().primitiveField()
);
}
else
{
fam.diag() = (coefft*rDeltaT2)*mesh().S();
fam.source() = rDeltaT2*mesh().S()*
(
coefft0*vf.oldTime().primitiveField()
- coefft00*vf.oldTime().oldTime().primitiveField()
);
}
return tfam;
}
template<class Type>
tmp<faMatrix<Type> >
EulerFaD2dt2Scheme<Type>::famD2dt2
(
const dimensionedScalar& rho,
const GeometricField<Type, faPatchField, areaMesh>& vf
)
{
tmp<faMatrix<Type> > tfam
(
new faMatrix<Type>
(
vf,
rho.dimensions()*vf.dimensions()*dimArea
/dimTime/dimTime
)
);
faMatrix<Type>& fam = tfam.ref();
scalar deltaT = deltaT_();
scalar deltaT0 = deltaT0_();
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
scalar rDeltaT2 = 4.0/sqr(deltaT + deltaT0);
if (mesh().moving())
{
scalar halfRdeltaT2 = 0.5*rDeltaT2;
scalarField SS0(mesh().S() + mesh().S0());
scalarField S0S00(mesh().S0() + mesh().S00());
fam.diag() = rho.value()*(coefft*halfRdeltaT2)*SS0;
fam.source() = halfRdeltaT2*rho.value()*
(
(coefft*SS0 + coefft00*S0S00)
*vf.oldTime().primitiveField()
- (coefft00*S0S00)*vf.oldTime().oldTime().primitiveField()
);
}
else
{
fam.diag() = (coefft*rDeltaT2)*mesh().S()*rho.value();
fam.source() = rDeltaT2*mesh().S()*rho.value()*
(
(coefft + coefft00)*vf.oldTime().primitiveField()
- coefft00*vf.oldTime().oldTime().primitiveField()
);
}
return tfam;
}
template<class Type>
tmp<faMatrix<Type>>
EulerFaD2dt2Scheme<Type>::famD2dt2
(
const areaScalarField& rho,
const GeometricField<Type, faPatchField, areaMesh>& vf
)
{
tmp<faMatrix<Type> > tfam
(
new faMatrix<Type>
(
vf,
rho.dimensions()*vf.dimensions()*dimArea/dimTime/dimTime
)
);
faMatrix<Type>& fam = tfam.ref();
scalar deltaT =deltaT_();
scalar deltaT0 = deltaT0_();
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
scalar rDeltaT2 = 4.0/sqr(deltaT + deltaT0);
if (mesh().moving())
{
scalar quarterRdeltaT2 = 0.25*rDeltaT2;
scalarField SS0rhoRho0
(
(mesh().S() + mesh().S0())
*(rho.primitiveField() + rho.oldTime().primitiveField())
);
scalarField S0S00rho0Rho00
(
(mesh().S0() + mesh().S00())
*(
rho.oldTime().primitiveField()
+ rho.oldTime().oldTime().primitiveField()
)
);
fam.diag() = (coefft*quarterRdeltaT2)*SS0rhoRho0;
fam.source() = quarterRdeltaT2*
(
(coefft*SS0rhoRho0 + coefft00*S0S00rho0Rho00)
*vf.oldTime().primitiveField()
- (coefft00*S0S00rho0Rho00)
*vf.oldTime().oldTime().primitiveField()
);
}
else
{
scalar halfRdeltaT2 = 0.5*rDeltaT2;
scalarField rhoRho0
(
rho.primitiveField() + rho.oldTime().primitiveField()
);
scalarField rho0Rho00
(
rho.oldTime().primitiveField()
+ rho.oldTime().oldTime().primitiveField()
);
fam.diag() = (coefft*halfRdeltaT2)*mesh().S()*rhoRho0;
fam.source() = halfRdeltaT2*mesh().S()*
(
(coefft*rhoRho0 + coefft00*rho0Rho00)
*vf.oldTime().primitiveField()
- (coefft00*rho0Rho00)
*vf.oldTime().oldTime().primitiveField()
);
}
return tfam;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fa
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,166 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2017 Volkswagen AG
-------------------------------------------------------------------------------
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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::fa::EulerFaD2dt2Scheme
Description
First-order Euler implicit d2dt2 using the current and two previous
time-step values.
SourceFiles
EulerFaD2dt2Scheme.C
\*---------------------------------------------------------------------------*/
#ifndef EulerFaD2dt2Scheme_H
#define EulerFaD2dt2Scheme_H
#include "faD2dt2Scheme.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fa
{
/*---------------------------------------------------------------------------*\
Class EulerD2dt2Scheme Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class EulerFaD2dt2Scheme
:
public fa::faD2dt2Scheme<Type>
{
// Private Member Functions
//- Return the current time-step
scalar deltaT_() const;
//- Return the previous time-step
scalar deltaT0_() const;
//- Disallow default bitwise copy construct
EulerFaD2dt2Scheme(const EulerFaD2dt2Scheme&);
//- Disallow default bitwise assignment
void operator=(const EulerFaD2dt2Scheme&);
public:
//- Runtime type information
TypeName("Euler");
// Constructors
//- Construct from mesh
EulerFaD2dt2Scheme(const faMesh& mesh)
:
faD2dt2Scheme<Type>(mesh)
{}
//- Construct from mesh and Istream
EulerFaD2dt2Scheme(const faMesh& mesh, Istream& is)
:
faD2dt2Scheme<Type>(mesh, is)
{}
// Member Functions
//- Return mesh reference
const faMesh& mesh() const
{
return fa::faD2dt2Scheme<Type>::mesh();
}
tmp<GeometricField<Type, faPatchField, areaMesh> > facD2dt2
(
const dimensioned<Type>
);
tmp<GeometricField<Type, faPatchField, areaMesh> > facD2dt2
(
const GeometricField<Type, faPatchField, areaMesh>&
);
tmp<GeometricField<Type, faPatchField, areaMesh> > facD2dt2
(
const dimensionedScalar&,
const GeometricField<Type, faPatchField, areaMesh>&
);
tmp<GeometricField<Type, faPatchField, areaMesh> > facD2dt2
(
const areaScalarField&,
const GeometricField<Type, faPatchField, areaMesh>&
);
tmp<faMatrix<Type> > famD2dt2
(
const GeometricField<Type, faPatchField, areaMesh>&
);
tmp<faMatrix<Type> > famD2dt2
(
const dimensionedScalar&,
const GeometricField<Type, faPatchField, areaMesh>&
);
tmp<faMatrix<Type> > famD2dt2
(
const areaScalarField&,
const GeometricField<Type, faPatchField, areaMesh>&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fa
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "EulerFaD2dt2Scheme.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,36 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2017 Volkswagen AG
-------------------------------------------------------------------------------
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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "EulerFaD2dt2Scheme.H"
#include "faMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFaD2dt2Scheme(EulerFaD2dt2Scheme)
// ************************************************************************* //

View File

@ -0,0 +1,101 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2017 Volkswagen AG
-------------------------------------------------------------------------------
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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Abstract base class for finite area d2dt2 schemes.
\*---------------------------------------------------------------------------*/
#include "fa.H"
#include "HashTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fa
{
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
template<class Type>
tmp<faD2dt2Scheme<Type> > faD2dt2Scheme<Type>::New
(
const faMesh& mesh,
Istream& schemeData
)
{
if (fa::debug)
{
InfoInFunction << "constructing faD2dt2Scheme<Type>"
<< endl;
}
if (schemeData.eof())
{
FatalIOErrorInFunction(schemeData)
<< "faD2dt2 scheme not specified" << nl << nl
<< "Valid faD2dt2 schemes are :" << endl
<< IstreamConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
const word schemeName(schemeData);
auto cstrIter = IstreamConstructorTablePtr_->cfind(schemeName);
if (!cstrIter.found())
{
FatalIOErrorInFunction(schemeData)
<< "Unknown d2dt2 scheme " << schemeName << nl << nl
<< "Valid d2dt2 schemes are :" << endl
<< IstreamConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
return cstrIter()(mesh, schemeData);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
faD2dt2Scheme<Type>::~faD2dt2Scheme()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fa
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,228 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2017 Volkswagen AG
-------------------------------------------------------------------------------
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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::fa::faD2dt2Scheme
Description
Abstract base class for d2dt2 schemes.
SourceFiles
faD2dt2Scheme.C
\*---------------------------------------------------------------------------*/
#ifndef faD2dt2Scheme_H
#define faD2dt2Scheme_H
#include "tmp.H"
#include "dimensionedType.H"
#include "areaFieldsFwd.H"
#include "edgeFieldsFwd.H"
#include "typeInfo.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
template<class Type>
class faMatrix;
class faMesh;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fa
{
/*---------------------------------------------------------------------------*\
Class faD2dt2Scheme Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class faD2dt2Scheme
:
public refCount
{
protected:
// Protected data
const faMesh& mesh_;
// Private Member Functions
//- Disallow copy construct
faD2dt2Scheme(const faD2dt2Scheme&);
//- Disallow default bitwise assignment
void operator=(const faD2dt2Scheme&);
public:
//- Runtime type information
virtual const word& type() const = 0;
// Declare run-time constructor selection tables
declareRunTimeSelectionTable
(
tmp,
faD2dt2Scheme,
Istream,
(const faMesh& mesh, Istream& schemeData),
(mesh, schemeData)
);
// Constructors
//- Construct from mesh
faD2dt2Scheme(const faMesh& mesh)
:
mesh_(mesh)
{}
//- Construct from mesh and Istream
faD2dt2Scheme(const faMesh& mesh, Istream&)
:
mesh_(mesh)
{}
// Selectors
//- Return a pointer to a new d2dt2Scheme created on freestore
static tmp<faD2dt2Scheme<Type> > New
(
const faMesh& mesh,
Istream& schemeData
);
//- Destructor
virtual ~faD2dt2Scheme();
// Member Functions
//- Return mesh reference
const faMesh& mesh() const
{
return mesh_;
}
virtual tmp<GeometricField<Type, faPatchField, areaMesh> > facD2dt2
(
const dimensioned<Type>
) = 0;
virtual tmp<GeometricField<Type, faPatchField, areaMesh> > facD2dt2
(
const GeometricField<Type, faPatchField, areaMesh>&
) = 0;
virtual tmp<GeometricField<Type, faPatchField, areaMesh> > facD2dt2
(
const dimensionedScalar&,
const GeometricField<Type, faPatchField, areaMesh>&
) = 0;
virtual tmp<GeometricField<Type, faPatchField, areaMesh> > facD2dt2
(
const areaScalarField&,
const GeometricField<Type, faPatchField, areaMesh>&
) = 0;
virtual tmp<faMatrix<Type> > famD2dt2
(
const GeometricField<Type, faPatchField, areaMesh>&
) = 0;
virtual tmp<faMatrix<Type> > famD2dt2
(
const dimensionedScalar&,
const GeometricField<Type, faPatchField, areaMesh>&
) = 0;
virtual tmp<faMatrix<Type> > famD2dt2
(
const areaScalarField&,
const GeometricField<Type, faPatchField, areaMesh>&
) = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fa
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Add the patch constructor functions to the hash tables
#define makeFaD2dt2TypeScheme(SS, Type) \
\
defineNamedTemplateTypeNameAndDebug(Foam::fa::SS<Foam::Type>, 0); \
\
namespace Foam \
{ \
namespace fa \
{ \
faD2dt2Scheme<Type>::addIstreamConstructorToTable<SS<Type> > \
add##SS##Type##IstreamConstructorToTable_; \
} \
}
#define makeFaD2dt2Scheme(SS) \
\
makeFaD2dt2TypeScheme(SS, scalar) \
makeFaD2dt2TypeScheme(SS, vector) \
makeFaD2dt2TypeScheme(SS, tensor)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "faD2dt2Scheme.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,69 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2017 Volkswagen AG
-------------------------------------------------------------------------------
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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "faD2dt2Scheme.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fa
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTemplateRunTimeSelectionTable
(
faD2dt2Scheme<scalar>,
Istream
);
defineTemplateRunTimeSelectionTable
(
faD2dt2Scheme<vector>,
Istream
);
defineTemplateRunTimeSelectionTable
(
faD2dt2Scheme<tensor>,
Istream
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fa
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -42,6 +42,7 @@ Description
#include "facAverage.H"
#include "facLnGrad.H"
#include "facDdt.H"
#include "facD2dt2.H"
#include "facNGrad.H"
#include "facNDiv.H"

View File

@ -0,0 +1,118 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2017 Volkswagen AG
-------------------------------------------------------------------------------
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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "facD2dt2.H"
#include "faMesh.H"
#include "faD2dt2Scheme.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fac
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
tmp<GeometricField<Type, faPatchField, areaMesh>> d2dt2
(
const dimensioned<Type> dt,
const faMesh& mesh
)
{
return fa::faD2dt2Scheme<Type>::New
(
mesh,
mesh.d2dt2Scheme("d2dt2(" + dt.name() + ')')
).ref().facD2dt2(dt);
}
template<class Type>
tmp<GeometricField<Type, faPatchField, areaMesh>> d2dt2
(
const GeometricField<Type, faPatchField, areaMesh>& vf
)
{
return fa::faD2dt2Scheme<Type>::New
(
vf.mesh(),
vf.mesh().d2dt2Scheme("d2dt2(" + vf.name() + ')')
).ref().facD2dt2(vf);
}
template<class Type>
tmp<GeometricField<Type, faPatchField, areaMesh>> d2dt2
(
const dimensionedScalar& rho,
const GeometricField<Type, faPatchField, areaMesh>& vf
)
{
return fa::faD2dt2Scheme<Type>::New
(
vf.mesh(),
vf.mesh().d2dt2Scheme
(
"d2dt2(" + rho.name() + ',' + vf.name() + ')'
)
).ref().facD2dt2(rho, vf);
}
template<class Type>
tmp<GeometricField<Type, faPatchField, areaMesh>> d2dt2
(
const areaScalarField& rho,
const GeometricField<Type, faPatchField, areaMesh>& vf
)
{
return fa::faD2dt2Scheme<Type>::New
(
vf.mesh(),
vf.mesh().d2dt2Scheme
(
"d2dt2(" + rho.name() + ',' + vf.name() + ')'
)
).ref().facD2dt2(rho, vf);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fac
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,101 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2017 Volkswagen AG
-------------------------------------------------------------------------------
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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace
fac
Description
Calculate the second temporal derivative.
SourceFiles
facD2dt2.C
\*---------------------------------------------------------------------------*/
#ifndef facD2dt2_H
#define facD2dt2_H
#include "areaFieldsFwd.H"
#include "edgeFieldsFwd.H"
#include "dimensionedTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Namespace fac functions Declaration
\*---------------------------------------------------------------------------*/
namespace fac
{
template<class Type>
tmp<GeometricField<Type, faPatchField, areaMesh> > d2dt2
(
const dimensioned<Type>,
const faMesh&
);
template<class Type>
tmp<GeometricField<Type, faPatchField, areaMesh> > d2dt2
(
const GeometricField<Type, faPatchField, areaMesh>&
);
template<class Type>
tmp<GeometricField<Type, faPatchField, areaMesh> > d2dt2
(
const dimensionedScalar&,
const GeometricField<Type, faPatchField, areaMesh>&
);
template<class Type>
tmp<GeometricField<Type, faPatchField, areaMesh> > d2dt2
(
const areaScalarField&,
const GeometricField<Type, faPatchField, areaMesh>&
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "facD2dt2.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -36,6 +36,7 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "famDdt.H"
#include "famD2dt2.H"
#include "famDiv.H"
#include "famLaplacian.H"
#include "famSup.H"

View File

@ -0,0 +1,104 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2017 Volkswagen AG
-------------------------------------------------------------------------------
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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "areaFields.H"
#include "edgeFields.H"
#include "faMatrix.H"
#include "faD2dt2Scheme.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
tmp<faMatrix<Type>> d2dt2
(
const GeometricField<Type, faPatchField, areaMesh>& vf
)
{
return fa::faD2dt2Scheme<Type>::New
(
vf.mesh(),
vf.mesh().d2dt2Scheme("d2dt2(" + vf.name() + ')')
).ref().famD2dt2(vf);
}
template<class Type>
tmp<faMatrix<Type>> d2dt2
(
const dimensionedScalar& rho,
const GeometricField<Type, faPatchField, areaMesh>& vf
)
{
return fa::faD2dt2Scheme<Type>::New
(
vf.mesh(),
vf.mesh().d2dt2Scheme
(
"d2dt2(" + rho.name() + ',' + vf.name() + ')'
)
).ref().famD2dt2(rho, vf);
}
template<class Type>
tmp<faMatrix<Type>> d2dt2
(
const areaScalarField& rho,
const GeometricField<Type, faPatchField, areaMesh>& vf
)
{
return fa::faD2dt2Scheme<Type>::New
(
vf.mesh(),
vf.mesh().ddtScheme
(
"d2dt2(" + rho.name() + ',' + vf.name() + ')'
)
).ref().famD2dt2(rho, vf);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,91 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2017 Volkswagen AG
-------------------------------------------------------------------------------
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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace
fam
Description
Calulate the matrix for the second temporal derivative.
SourceFiles
famD2dt2.C
\*---------------------------------------------------------------------------*/
#ifndef famD2dt2_H
#define famD2dt2_H
#include "areaFieldsFwd.H"
#include "faMatrix.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Namespace fam functions Declaration
\*---------------------------------------------------------------------------*/
namespace fam
{
template<class Type>
tmp<faMatrix<Type> > d2dt2
(
const GeometricField<Type, faPatchField, areaMesh>&
);
template<class Type>
tmp<faMatrix<Type> > d2dt2
(
const dimensionedScalar&,
const GeometricField<Type, faPatchField, areaMesh>&
);
template<class Type>
tmp<faMatrix<Type> > d2dt2
(
const areaScalarField&,
const GeometricField<Type, faPatchField, areaMesh>&
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "famD2dt2.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //