-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added an incompressible alphatWallFunction.
- Loading branch information
Showing
3 changed files
with
320 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
157 changes: 157 additions & 0 deletions
157
.../boundaryConditions/alphatWallFunctionIncomp/alphatWallFunctionIncompFvPatchScalarField.C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
/*---------------------------------------------------------------------------*\ | ||
========= | | ||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
\\ / O peration | | ||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation | ||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd | ||
------------------------------------------------------------------------------- | ||
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 "alphatWallFunctionIncompFvPatchScalarField.H" | ||
#include "fvPatchFieldMapper.H" | ||
#include "volFields.H" | ||
#include "addToRunTimeSelectionTable.H" | ||
|
||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
namespace Foam | ||
{ | ||
namespace incompressible | ||
{ | ||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
|
||
alphatWallFunctionIncompressibleFvPatchScalarField:: | ||
alphatWallFunctionIncompressibleFvPatchScalarField | ||
( | ||
const fvPatch& p, | ||
const DimensionedField<scalar, volMesh>& iF | ||
) | ||
: | ||
fixedValueFvPatchScalarField(p, iF), | ||
Prt_(0.85) | ||
{ | ||
} | ||
|
||
|
||
alphatWallFunctionIncompressibleFvPatchScalarField:: | ||
alphatWallFunctionIncompressibleFvPatchScalarField | ||
( | ||
const alphatWallFunctionIncompressibleFvPatchScalarField& ptf, | ||
const fvPatch& p, | ||
const DimensionedField<scalar, volMesh>& iF, | ||
const fvPatchFieldMapper& mapper | ||
) | ||
: | ||
fixedValueFvPatchScalarField(ptf, p, iF, mapper), | ||
Prt_(ptf.Prt_) | ||
{ | ||
} | ||
|
||
|
||
alphatWallFunctionIncompressibleFvPatchScalarField:: | ||
alphatWallFunctionIncompressibleFvPatchScalarField | ||
( | ||
const fvPatch& p, | ||
const DimensionedField<scalar, volMesh>& iF, | ||
const dictionary& dict | ||
) | ||
: | ||
fixedValueFvPatchScalarField(p, iF, dict), | ||
Prt_(dict.get<scalar>("Prt")) // force read to avoid ambiguity | ||
{ | ||
} | ||
|
||
|
||
alphatWallFunctionIncompressibleFvPatchScalarField:: | ||
alphatWallFunctionIncompressibleFvPatchScalarField | ||
( | ||
const alphatWallFunctionIncompressibleFvPatchScalarField& wfpsf | ||
) | ||
: | ||
fixedValueFvPatchScalarField(wfpsf), | ||
Prt_(wfpsf.Prt_) | ||
{ | ||
} | ||
|
||
|
||
alphatWallFunctionIncompressibleFvPatchScalarField:: | ||
alphatWallFunctionIncompressibleFvPatchScalarField | ||
( | ||
const alphatWallFunctionIncompressibleFvPatchScalarField& wfpsf, | ||
const DimensionedField<scalar, volMesh>& iF | ||
) | ||
: | ||
fixedValueFvPatchScalarField(wfpsf, iF), | ||
Prt_(wfpsf.Prt_) | ||
{ | ||
} | ||
|
||
|
||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
|
||
void alphatWallFunctionIncompressibleFvPatchScalarField::updateCoeffs() | ||
{ | ||
if (updated()) | ||
{ | ||
return; | ||
} | ||
|
||
const label patchi = patch().index(); | ||
|
||
// Retrieve turbulence properties from model | ||
|
||
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel> | ||
( | ||
IOobject::groupName | ||
( | ||
turbulenceModel::propertiesName, | ||
internalField().group() | ||
) | ||
); | ||
|
||
const tmp<scalarField> tnutw = turbModel.nut(patchi); | ||
|
||
operator==(tnutw/Prt_); | ||
|
||
fixedValueFvPatchField<scalar>::updateCoeffs(); | ||
} | ||
|
||
|
||
void alphatWallFunctionIncompressibleFvPatchScalarField::write(Ostream& os) const | ||
{ | ||
fvPatchField<scalar>::write(os); | ||
os.writeEntry("Prt", Prt_); | ||
writeEntry("value", os); | ||
} | ||
|
||
|
||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
makePatchTypeField | ||
( | ||
fvPatchScalarField, | ||
alphatWallFunctionIncompressibleFvPatchScalarField | ||
); | ||
|
||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
} // End namespace incompressible | ||
} // End namespace Foam | ||
|
||
// ************************************************************************* // |
162 changes: 162 additions & 0 deletions
162
.../boundaryConditions/alphatWallFunctionIncomp/alphatWallFunctionIncompFvPatchScalarField.H
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
/*---------------------------------------------------------------------------*\ | ||
DAFoam : Discrete Adjoint with OpenFOAM | ||
Version : v3 | ||
This file is modified from OpenFOAM's source code | ||
src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/ | ||
wallFunctions/alphatWallFunctionIncompressibles/alphatWallFunctionIncompressible | ||
The turbulent thermal diffusivity calculated using: | ||
\f[ | ||
\alpha_t = \frac{\nu_t}{Pr_t} | ||
\f] | ||
OpenFOAM: The Open Source CFD Toolbox | ||
Copyright (C): 2011-2016 OpenFOAM Foundation | ||
OpenFOAM License: | ||
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/>. | ||
Description: | ||
Fixed traction boundary condition for the standard linear elastic, | ||
fixed coefficient displacement equation. | ||
\*---------------------------------------------------------------------------*/ | ||
|
||
#ifndef alphatWallFunctionIncompressibleFvPatchScalarField_H | ||
#define alphatWallFunctionIncompressibleFvPatchScalarField_H | ||
|
||
#include "fixedValueFvPatchFields.H" | ||
#include "turbulenceModel.H" | ||
|
||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
namespace Foam | ||
{ | ||
namespace incompressible | ||
{ | ||
|
||
/*---------------------------------------------------------------------------*\ | ||
Class alphatWallFunctionIncompressibleFvPatchScalarField Declaration | ||
\*---------------------------------------------------------------------------*/ | ||
|
||
class alphatWallFunctionIncompressibleFvPatchScalarField | ||
: | ||
public fixedValueFvPatchScalarField | ||
{ | ||
protected: | ||
|
||
// Protected data | ||
|
||
//- Turbulent Prandtl number | ||
scalar Prt_; | ||
|
||
public: | ||
|
||
//- Runtime type information | ||
TypeName("incompressible::alphatWallFunction"); | ||
|
||
|
||
// Constructors | ||
|
||
//- Construct from patch and internal field | ||
alphatWallFunctionIncompressibleFvPatchScalarField | ||
( | ||
const fvPatch&, | ||
const DimensionedField<scalar, volMesh>& | ||
); | ||
|
||
//- Construct from patch, internal field and dictionary | ||
alphatWallFunctionIncompressibleFvPatchScalarField | ||
( | ||
const fvPatch&, | ||
const DimensionedField<scalar, volMesh>&, | ||
const dictionary& | ||
); | ||
|
||
//- Construct by mapping given | ||
// alphatWallFunctionIncompressibleFvPatchScalarField | ||
// onto a new patch | ||
alphatWallFunctionIncompressibleFvPatchScalarField | ||
( | ||
const alphatWallFunctionIncompressibleFvPatchScalarField&, | ||
const fvPatch&, | ||
const DimensionedField<scalar, volMesh>&, | ||
const fvPatchFieldMapper& | ||
); | ||
|
||
//- Construct as copy | ||
alphatWallFunctionIncompressibleFvPatchScalarField | ||
( | ||
const alphatWallFunctionIncompressibleFvPatchScalarField& | ||
); | ||
|
||
//- Construct and return a clone | ||
virtual tmp<fvPatchScalarField> clone() const | ||
{ | ||
return tmp<fvPatchScalarField> | ||
( | ||
new alphatWallFunctionIncompressibleFvPatchScalarField(*this) | ||
); | ||
} | ||
|
||
//- Construct as copy setting internal field reference | ||
alphatWallFunctionIncompressibleFvPatchScalarField | ||
( | ||
const alphatWallFunctionIncompressibleFvPatchScalarField&, | ||
const DimensionedField<scalar, volMesh>& | ||
); | ||
|
||
//- Construct and return a clone setting internal field reference | ||
virtual tmp<fvPatchScalarField> clone | ||
( | ||
const DimensionedField<scalar, volMesh>& iF | ||
) const | ||
{ | ||
return tmp<fvPatchScalarField> | ||
( | ||
new alphatWallFunctionIncompressibleFvPatchScalarField(*this, iF) | ||
); | ||
} | ||
|
||
|
||
// Member functions | ||
|
||
// Evaluation functions | ||
|
||
//- Update the coefficients associated with the patch field | ||
virtual void updateCoeffs(); | ||
|
||
|
||
// I-O | ||
|
||
//- Write | ||
virtual void write(Ostream&) const; | ||
}; | ||
|
||
|
||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
} // End namespace incompressible | ||
} // End namespace Foam | ||
|
||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
#endif | ||
|
||
// ************************************************************************* // |