Integrated Foundation code to commit 104aac5

This commit is contained in:
Andrew Heather
2017-05-17 16:35:18 +01:00
590 changed files with 5963 additions and 3699 deletions

View File

@ -1,4 +1,9 @@
interfaceProperties.C
interfaceCompression/interfaceCompression.C
surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.C
surfaceTensionModels/surfaceTensionModel/newSurfaceTensionModel.C
surfaceTensionModels/constant/constantSurfaceTension.C
surfaceTensionModels/temperatureDependent/temperatureDependentSurfaceTension.C
LIB = $(FOAM_LIBBIN)/libinterfaceProperties

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -167,7 +167,8 @@ Foam::interfaceProperties::interfaceProperties
alpha1.mesh().solverDict(alpha1.name()).lookup("cAlpha")
)
),
sigma_("sigma", dimensionSet(1, 0, -2, 0, 0), dict),
sigmaPtr_(surfaceTensionModel::New(dict, alpha1.mesh())),
deltaN_
(
@ -208,6 +209,13 @@ Foam::interfaceProperties::interfaceProperties
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::interfaceProperties::sigmaK() const
{
return sigmaPtr_->sigma()*K_;
}
Foam::tmp<Foam::surfaceScalarField>
Foam::interfaceProperties::surfaceTensionForce() const
{
@ -231,7 +239,7 @@ void Foam::interfaceProperties::correct()
bool Foam::interfaceProperties::read()
{
alpha1_.mesh().solverDict(alpha1_.name()).lookup("cAlpha") >> cAlpha_;
transportPropertiesDict_.lookup("sigma") >> sigma_;
sigmaPtr_->read(transportPropertiesDict_);
return true;
}

View File

@ -40,6 +40,7 @@ SourceFiles
#define interfaceProperties_H
#include "IOdictionary.H"
#include "surfaceTensionModel.H"
#include "volFields.H"
#include "surfaceFields.H"
@ -63,7 +64,7 @@ class interfaceProperties
scalar cAlpha_;
//- Surface tension
dimensionedScalar sigma_;
autoPtr<surfaceTensionModel> sigmaPtr_;
//- Stabilisation for normalisation of the interface normal
const dimensionedScalar deltaN_;
@ -127,10 +128,7 @@ public:
return nHatf_;
}
tmp<volScalarField> sigmaK() const
{
return sigma_*K_;
}
tmp<volScalarField> sigmaK() const;
tmp<surfaceScalarField> surfaceTensionForce() const;

View File

@ -0,0 +1,116 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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 "constantSurfaceTension.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace surfaceTensionModels
{
defineTypeNameAndDebug(constant, 0);
addToRunTimeSelectionTable(surfaceTensionModel, constant, dictionary);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::surfaceTensionModels::constant::constant
(
const dictionary& dict,
const fvMesh& mesh
)
:
surfaceTensionModel(mesh),
sigma_("sigma", dimensionSet(1, 0, -2, 0, 0), dict)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::surfaceTensionModels::constant::~constant()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::surfaceTensionModels::constant::sigma() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"sigma",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
sigma_
)
);
}
bool Foam::surfaceTensionModels::constant::read(const dictionary& dict)
{
// Handle sub-dictionary format as a special case
if (dict.isDict("sigma"))
{
dict.subDict("sigma").lookup("sigma") >> sigma_;
}
else
{
dict.lookup("sigma") >> sigma_;
}
return true;
}
bool Foam::surfaceTensionModels::constant::writeData(Ostream& os) const
{
if (surfaceTensionModel::writeData(os))
{
os << sigma_ << token::END_STATEMENT << nl;
return os.good();
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,117 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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::surfaceTensionModels::constant
Description
Uniform constant surface tension model.
Usage
Example of the surface tension specification:
\verbatim
sigma
{
type constant;
sigma 0.07;
}
\endverbatim
See also
Foam::surfaceTensionModel
SourceFiles
constantSurfaceTension.C
\*---------------------------------------------------------------------------*/
#ifndef constantSurfaceTension_H
#define constantSurfaceTension_H
#include "surfaceTensionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace surfaceTensionModels
{
/*---------------------------------------------------------------------------*\
Class constant Declaration
\*---------------------------------------------------------------------------*/
class constant
:
public surfaceTensionModel
{
// Private data
//- Surface tension coefficient
dimensionedScalar sigma_;
public:
//- Runtime type information
TypeName("constant");
// Constructors
//- Construct from dictionary and mesh
constant
(
const dictionary& dict,
const fvMesh& mesh
);
//- Destructor
virtual ~constant();
// Member Functions
//- Surface tension coefficient
virtual tmp<volScalarField> sigma() const;
//- Update surface tension coefficient from given dictionary
virtual bool read(const dictionary& dict);
//- Write in dictionary format
virtual bool writeData(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceTensionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,71 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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 "surfaceTensionModel.H"
#include "constantSurfaceTension.H"
// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::surfaceTensionModel> Foam::surfaceTensionModel::New
(
const dictionary& dict,
const fvMesh& mesh
)
{
if (dict.isDict("sigma"))
{
const dictionary& sigmaDict = surfaceTensionModel::sigmaDict(dict);
word surfaceTensionModelType(sigmaDict.lookup("type"));
Info<< "Selecting surfaceTensionModel "
<< surfaceTensionModelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(surfaceTensionModelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorInFunction
<< "Unknown surfaceTensionModelType type "
<< surfaceTensionModelType << endl << endl
<< "Valid surfaceTensionModel types are : " << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return cstrIter()(sigmaDict, mesh);
}
else
{
return autoPtr<surfaceTensionModel>
(
new surfaceTensionModels::constant(dict, mesh)
);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,73 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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 "surfaceTensionModel.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(surfaceTensionModel, 0);
defineRunTimeSelectionTable(surfaceTensionModel, dictionary);
}
const Foam::dimensionSet Foam::surfaceTensionModel::dimSigma(1, 0, -2, 0, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::surfaceTensionModel::surfaceTensionModel(const fvMesh& mesh)
:
regIOobject
(
IOobject
(
typeName, mesh.name(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
)
),
mesh_(mesh)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::surfaceTensionModel::~surfaceTensionModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::surfaceTensionModel::writeData(Ostream& os) const
{
return os.good();
}
// ************************************************************************* //

View File

@ -0,0 +1,161 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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::surfaceTensionModel
Description
Abstract base-class for surface tension models which return the surface
tension coefficient field.
Usage
Example of the surface tension specification:
\verbatim
sigma
{
type <surface tension model type>;
<coefficient name> <coefficient value>;
.
.
.
}
\endverbatim
For simplicity and backward-compatibility the constant value format is
also supported, e.g.
\verbatim
sigma 0.07;
\endverbatim
SourceFiles
surfaceTensionModel.C
newSurfaceTensionModel.C
\*---------------------------------------------------------------------------*/
#ifndef surfaceTensionModel_H
#define surfaceTensionModel_H
#include "regIOobject.H"
#include "dimensionedTypes.H"
#include "volFieldsFwd.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class fvMesh;
/*---------------------------------------------------------------------------*\
Class surfaceTensionModel Declaration
\*---------------------------------------------------------------------------*/
class surfaceTensionModel
:
public regIOobject
{
protected:
// Protected member data
//- Reference to mesh
const fvMesh& mesh_;
// Protected member functions
static const dictionary& sigmaDict(const dictionary& dict)
{
return dict.subDict("sigma");
}
public:
//- Runtime type information
TypeName("surfaceTensionModel");
// Declare runtime construction
declareRunTimeSelectionTable
(
autoPtr,
surfaceTensionModel,
dictionary,
(
const dictionary& dict,
const fvMesh& mesh
),
(dict, mesh)
);
// Static data members
//- Surface tension coefficient dimensions
static const dimensionSet dimSigma;
// Constructors
// Construct from mesh
surfaceTensionModel(const fvMesh& mesh);
//- Destructor
virtual ~surfaceTensionModel();
// Selectors
static autoPtr<surfaceTensionModel> New
(
const dictionary& dict,
const fvMesh& mesh
);
// Member Functions
//- Surface tension coefficient
virtual tmp<volScalarField> sigma() const = 0;
//- Update surface tension coefficient from given dictionary
virtual bool read(const dictionary& dict) = 0;
//- Write in dictionary format
virtual bool writeData(Ostream& os) const = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,138 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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 "temperatureDependentSurfaceTension.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace surfaceTensionModels
{
defineTypeNameAndDebug(temperatureDependent, 0);
addToRunTimeSelectionTable
(
surfaceTensionModel,
temperatureDependent,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::surfaceTensionModels::temperatureDependent::temperatureDependent
(
const dictionary& dict,
const fvMesh& mesh
)
:
surfaceTensionModel(mesh),
TName_(dict.lookupOrDefault<word>("T", "T")),
sigma_(Function1<scalar>::New("sigma", dict))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::surfaceTensionModels::temperatureDependent::~temperatureDependent()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::surfaceTensionModels::temperatureDependent::sigma() const
{
tmp<volScalarField> tsigma
(
new volScalarField
(
IOobject
(
"sigma",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
dimSigma
)
);
volScalarField& sigma = tsigma.ref();
const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_);
sigma.field() = sigma_->value(T.field());
volScalarField::Boundary& sigmaBf = sigma.boundaryFieldRef();
const volScalarField::Boundary& TBf = T.boundaryField();
forAll(sigmaBf, patchi)
{
sigmaBf[patchi] = sigma_->value(TBf[patchi]);
}
return tsigma;
}
bool Foam::surfaceTensionModels::temperatureDependent::read
(
const dictionary& dict
)
{
const dictionary& sigmaDict = surfaceTensionModel::sigmaDict(dict);
TName_ = sigmaDict.lookupOrDefault<word>("T", "T");
sigma_ = Function1<scalar>::New("sigma", sigmaDict);
return true;
}
bool Foam::surfaceTensionModels::temperatureDependent::writeData
(
Ostream& os
) const
{
if (surfaceTensionModel::writeData(os))
{
os << sigma_() << token::END_STATEMENT << nl;
return os.good();
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,132 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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::surfaceTensionModels::temperatureDependent
Description
Temperature-dependent surface tension model.
The surface tension is evaluated from the specified Foam::Function1 for the
temperature field looked-up from the mesh database the name of which
may optionally be provided.
Usage
\table
Property | Description | Required | Default value
T | Temperature field name | no | T
sigma | Surface tension function | yes |
\endtable
Example of the surface tension specification:
\verbatim
sigma
{
type temperatureDependent;
sigma constant 0.07;
}
\endverbatim
See also
Foam::surfaceTensionModel
Foam::Function1
SourceFiles
temperatureDependentSurfaceTension.C
\*---------------------------------------------------------------------------*/
#ifndef temperatureDependentSurfaceTension_H
#define temperatureDependentSurfaceTension_H
#include "surfaceTensionModel.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace surfaceTensionModels
{
/*---------------------------------------------------------------------------*\
Class temperatureDependent Declaration
\*---------------------------------------------------------------------------*/
class temperatureDependent
:
public surfaceTensionModel
{
// Private data
//- Name of temperature field, default = "T"
word TName_;
//- Surface-tension function
autoPtr<Function1<scalar>> sigma_;
public:
//- Runtime type information
TypeName("temperatureDependent");
// Constructors
//- Construct from dictionary and mesh
temperatureDependent
(
const dictionary& dict,
const fvMesh& mesh
);
//- Destructor
virtual ~temperatureDependent();
// Member Functions
//- Surface tension coefficient
virtual tmp<volScalarField> sigma() const;
//- Update surface tension coefficient from given dictionary
virtual bool read(const dictionary& dict);
//- Write in dictionary format
virtual bool writeData(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceTensionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //