ENH: Refactored film shear stress model -> film turbulence model

This commit is contained in:
andy 2013-05-13 17:51:23 +01:00
parent fc73c4629a
commit d99266c2e6
9 changed files with 607 additions and 11 deletions

View File

@ -24,6 +24,10 @@ $(KINEMATICMODELS)/injectionModel/drippingInjection/drippingInjection.C
$(KINEMATICMODELS)/injectionModel/removeInjection/removeInjection.C
$(KINEMATICMODELS)/injectionModel/curvatureSeparation/curvatureSeparation.C
$(KINEMATICMODELS)/filmTurbulenceModel/filmTurbulenceModel/filmTurbulenceModel.C
$(KINEMATICMODELS)/filmTurbulenceModel/filmTurbulenceModel/filmTurbulenceModelNew.C
$(KINEMATICMODELS)/filmTurbulenceModel/laminar/laminar.C
THERMOMODELS=submodels/thermo
$(THERMOMODELS)/phaseChangeModel/phaseChangeModel/phaseChangeModel.C
$(THERMOMODELS)/phaseChangeModel/phaseChangeModel/phaseChangeModelNew.C

View File

@ -163,7 +163,7 @@ tmp<volScalarField> kinematicSingleLayer::pu()
(
IOobject
(
"pu",
typeName + ":pu",
time_.timeName(),
regionMesh(),
IOobject::NO_READ,
@ -185,7 +185,7 @@ tmp<volScalarField> kinematicSingleLayer::pp()
(
IOobject
(
"pp",
typeName + ":pp",
time_.timeName(),
regionMesh(),
IOobject::NO_READ,
@ -216,6 +216,8 @@ void kinematicSingleLayer::updateSubmodels()
// Update source fields
const dimensionedScalar deltaT = time().deltaT();
rhoSp_ += cloudMassTrans_/magSf()/deltaT;
turbulence_->correct();
}
@ -282,9 +284,7 @@ void kinematicSingleLayer::updateSurfaceVelocities()
Uw_ -= nHat()*(Uw_ & nHat());
Uw_.correctBoundaryConditions();
// apply quadratic profile to surface velocity (scale by sqrt(2))
Us_ = 1.414*U_;
Us_.correctBoundaryConditions();
Us_ = turbulence_->Us();
}
@ -309,6 +309,7 @@ tmp<Foam::fvVectorMatrix> kinematicSingleLayer::solveMomentum
// - fvm::SuSp(rhoSp_, U_)
- rhoSp_*U_
+ forces_.correct(U_)
+ turbulence_->Su(U_)
);
fvVectorMatrix& UEqn = tUEqn();
@ -779,6 +780,8 @@ kinematicSingleLayer::kinematicSingleLayer
injection_(*this, coeffs_),
turbulence_(filmTurbulenceModel::New(*this, coeffs_)),
forces_(*this, coeffs_),
addedMassTotal_(0.0)
@ -1020,7 +1023,7 @@ tmp<volScalarField> kinematicSingleLayer::primaryMassTrans() const
(
IOobject
(
"kinematicSingleLayer::primaryMassTrans",
typeName + ":primaryMassTrans",
time().timeName(),
primaryMesh(),
IOobject::NO_READ,
@ -1075,7 +1078,7 @@ tmp<DimensionedField<scalar, volMesh> > kinematicSingleLayer::Srho() const
(
IOobject
(
"kinematicSingleLayer::Srho",
typeName + ":Srho",
time().timeName(),
primaryMesh(),
IOobject::NO_READ,
@ -1100,7 +1103,7 @@ tmp<DimensionedField<scalar, volMesh> > kinematicSingleLayer::Srho
(
IOobject
(
"kinematicSingleLayer::Srho(" + Foam::name(i) + ")",
typeName + ":Srho(" + Foam::name(i) + ")",
time().timeName(),
primaryMesh(),
IOobject::NO_READ,
@ -1122,7 +1125,7 @@ tmp<DimensionedField<scalar, volMesh> > kinematicSingleLayer::Sh() const
(
IOobject
(
"kinematicSingleLayer::Sh",
typeName + ":Sh",
time().timeName(),
primaryMesh(),
IOobject::NO_READ,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -43,6 +43,7 @@ SourceFiles
#include "injectionModelList.H"
#include "forceList.H"
#include "filmTurbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -197,6 +198,9 @@ protected:
//- Cloud injection
injectionModelList injection_;
//- Turbulence model
autoPtr<filmTurbulenceModel> turbulence_;
//- List of film forces
forceList forces_;
@ -444,6 +448,9 @@ public:
//- Injection
inline injectionModelList& injection();
//- Turbulence
inline const filmTurbulenceModel& turbulence() const;
// Helper functions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -169,6 +169,12 @@ inline injectionModelList& kinematicSingleLayer::injection()
}
inline const filmTurbulenceModel& kinematicSingleLayer::turbulence() const
{
return turbulence_();
}
inline tmp<volScalarField> kinematicSingleLayer::mass() const
{
return rho_*delta_*magSf();

View File

@ -0,0 +1,73 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 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 "filmTurbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(filmTurbulenceModel, 0);
defineRunTimeSelectionTable(filmTurbulenceModel, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
filmTurbulenceModel::filmTurbulenceModel(const surfaceFilmModel& owner)
:
subModelBase(owner)
{}
filmTurbulenceModel::filmTurbulenceModel
(
const word& type,
const surfaceFilmModel& owner,
const dictionary& dict
)
:
subModelBase(type, owner, dict)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
filmTurbulenceModel::~filmTurbulenceModel()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,148 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 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::regionModels::surfaceFilmModels::filmTurbulenceModel
Description
Base class for film turbulence models
SourceFiles
filmTurbulenceModel.C
filmTurbulenceModelNew.C
\*---------------------------------------------------------------------------*/
#ifndef filmTurbulenceModel_H
#define filmTurbulenceModel_H
#include "subModelBase.H"
#include "runTimeSelectionTables.H"
#include "fvMatricesFwd.H"
#include "volFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class filmTurbulenceModel Declaration
\*---------------------------------------------------------------------------*/
class filmTurbulenceModel
:
public subModelBase
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
filmTurbulenceModel(const filmTurbulenceModel&);
//- Disallow default bitwise assignment
void operator=(const filmTurbulenceModel&);
public:
//- Runtime type information
TypeName("filmTurbulenceModel");
// Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
filmTurbulenceModel,
dictionary,
(
const surfaceFilmModel& owner,
const dictionary& dict
),
(owner, dict)
);
// Constructors
//- Construct null
filmTurbulenceModel(const surfaceFilmModel& owner);
//- Construct from type name, dictionary and surface film model
filmTurbulenceModel
(
const word& type,
const surfaceFilmModel& owner,
const dictionary& dict
);
// Selectors
//- Return a reference to the selected injection model
static autoPtr<filmTurbulenceModel> New
(
const surfaceFilmModel& owner,
const dictionary& dict
);
//- Destructor
virtual ~filmTurbulenceModel();
// Member Functions
// Evolution
//- Return the film surface velocity
virtual tmp<volVectorField> Us() const = 0;
//- Return the film turbulence viscosity
virtual tmp<volScalarField> mut() const = 0;
//- Correct/update the model
virtual void correct() = 0;
//- Return the source for the film momentum equation
virtual tmp<fvVectorMatrix> Su(volVectorField& U) const = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,77 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 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 "filmTurbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
autoPtr<filmTurbulenceModel> filmTurbulenceModel::New
(
const surfaceFilmModel& model,
const dictionary& dict
)
{
const word modelType(dict.lookup("turbulence"));
Info<< " " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"filmTurbulenceModel::New"
"("
"const surfaceFilmModel&, "
"const dictionary&"
")"
) << "Unknown filmTurbulenceModel type " << modelType
<< nl << nl << "Valid filmTurbulenceModel types are:" << nl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
return autoPtr<filmTurbulenceModel>(cstrIter()(model, dict));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,160 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 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 "laminar.H"
#include "addToRunTimeSelectionTable.H"
#include "fvMesh.H"
#include "fvMatrices.H"
#include "Time.H"
#include "volFields.H"
#include "fvmSup.H"
#include "kinematicSingleLayer.H"
#include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(laminar, 0);
addToRunTimeSelectionTable(filmTurbulenceModel, laminar, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
laminar::laminar
(
const surfaceFilmModel& owner,
const dictionary& dict
)
:
filmTurbulenceModel(type(), owner, dict),
Cf_(readScalar(coeffs_.lookup("Cf")))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
laminar::~laminar()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
tmp<volVectorField> laminar::Us() const
{
tmp<volVectorField> tUs
(
new volVectorField
(
IOobject
(
typeName + ".Us",
owner_.regionMesh().time().timeName(),
owner_.regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
owner_.regionMesh(),
dimensionedVector("zero", dimVelocity, vector::zero),
zeroGradientFvPatchVectorField::typeName
)
);
// apply quadratic profile
tUs() = Foam::sqrt(2.0)*owner_.U();
tUs().correctBoundaryConditions();
return tUs;
}
tmp<volScalarField> laminar::mut() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
typeName + ".mut",
owner_.regionMesh().time().timeName(),
owner_.regionMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
owner_.regionMesh(),
dimensionedScalar("zero", dimMass/dimLength/dimTime, 0.0)
)
);
}
void laminar::correct()
{
// do nothing
}
tmp<fvVectorMatrix> laminar::Su(volVectorField& U) const
{
// local reference to film model
const kinematicSingleLayer& film =
static_cast<const kinematicSingleLayer&>(owner_);
// local references to film fields
const volScalarField& mu = film.mu();
const volVectorField& Uw = film.Uw();
const volVectorField& Us = film.Us();
const volScalarField& delta = film.delta();
const volVectorField& Up = film.UPrimary();
const volScalarField& rhop = film.rhoPrimary();
// employ simple coeff-based model
volScalarField Cs("Cs", Cf_*rhop*mag(Up - Us));
dimensionedScalar d0("SMALL", delta.dimensions(), SMALL);
volScalarField Cw("Cw", mu/(0.3333*(delta + d0)));
Cw.min(5000.0);
return
(
- fvm::Sp(Cs, U) + Cs*Us // surface contribution
- fvm::Sp(Cw, U) + Cw*Uw // wall contribution
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,118 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 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::regionModels::surfaceFilmModels::laminar
Description
Film laminar turbulence model.
SourceFiles
laminar.C
\*---------------------------------------------------------------------------*/
#ifndef laminar_H
#define laminar_H
#include "filmTurbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class laminar Declaration
\*---------------------------------------------------------------------------*/
class laminar
:
public filmTurbulenceModel
{
private:
// Private Data
//- Surface roughness coefficient
scalar Cf_;
// Private member functions
//- Disallow default bitwise copy construct
laminar(const laminar&);
//- Disallow default bitwise assignment
void operator=(const laminar&);
public:
//- Runtime type information
TypeName("laminar");
// Constructors
//- Construct from surface film model
laminar(const surfaceFilmModel& owner, const dictionary& dict);
//- Destructor
virtual ~laminar();
// Member Functions
// Evolution
//- Return the film surface velocity
virtual tmp<volVectorField> Us() const;
//- Return the film turbulence viscosity
virtual tmp<volScalarField> mut() const;
//- Correct/update the model
virtual void correct();
//- Return the source for the film momentum equation
virtual tmp<fvVectorMatrix> Su(volVectorField& U) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace regionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //