diff --git a/src/adjoint/Make/files_Incompressible b/src/adjoint/Make/files_Incompressible index 18b93b41..f2916074 100755 --- a/src/adjoint/Make/files_Incompressible +++ b/src/adjoint/Make/files_Incompressible @@ -107,6 +107,7 @@ boundaryConditions/multiFreqVector/multiFreqVectorFvPatchField.C boundaryConditions/nutUSpaldingWallFunctionDF/nutUSpaldingWallFunctionFvPatchScalarFieldDF.C boundaryConditions/varyingVelocity/varyingVelocityFvPatchVectorField.C boundaryConditions/varyingVelocityInletOutlet/varyingVelocityInletOutletFvPatchVectorField.C +boundaryConditions/alphatWallFunctionIncomp/alphatWallFunctionIncompFvPatchScalarField.C models/dummyTurbulenceModel/makeDummyTurbulenceModelIncompressible.C models/SpalartAllmarasFv3/makeSpalartAllmarasFv3Incompressible.C models/SpalartAllmarasFv3FieldInversion/makeSpalartAllmarasFv3FieldInversionIncompressible.C diff --git a/src/adjoint/boundaryConditions/alphatWallFunctionIncomp/alphatWallFunctionIncompFvPatchScalarField.C b/src/adjoint/boundaryConditions/alphatWallFunctionIncomp/alphatWallFunctionIncompFvPatchScalarField.C new file mode 100755 index 00000000..58f0eedb --- /dev/null +++ b/src/adjoint/boundaryConditions/alphatWallFunctionIncomp/alphatWallFunctionIncompFvPatchScalarField.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#include "alphatWallFunctionIncompFvPatchScalarField.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +alphatWallFunctionIncompressibleFvPatchScalarField:: +alphatWallFunctionIncompressibleFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(p, iF), + Prt_(0.85) +{ +} + + +alphatWallFunctionIncompressibleFvPatchScalarField:: +alphatWallFunctionIncompressibleFvPatchScalarField +( + const alphatWallFunctionIncompressibleFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + Prt_(ptf.Prt_) +{ +} + + +alphatWallFunctionIncompressibleFvPatchScalarField:: +alphatWallFunctionIncompressibleFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF, dict), + Prt_(dict.get("Prt")) // force read to avoid ambiguity +{ +} + + +alphatWallFunctionIncompressibleFvPatchScalarField:: +alphatWallFunctionIncompressibleFvPatchScalarField +( + const alphatWallFunctionIncompressibleFvPatchScalarField& wfpsf +) +: + fixedValueFvPatchScalarField(wfpsf), + Prt_(wfpsf.Prt_) +{ +} + + +alphatWallFunctionIncompressibleFvPatchScalarField:: +alphatWallFunctionIncompressibleFvPatchScalarField +( + const alphatWallFunctionIncompressibleFvPatchScalarField& wfpsf, + const DimensionedField& 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 + ( + IOobject::groupName + ( + turbulenceModel::propertiesName, + internalField().group() + ) + ); + + const tmp tnutw = turbModel.nut(patchi); + + operator==(tnutw/Prt_); + + fixedValueFvPatchField::updateCoeffs(); +} + + +void alphatWallFunctionIncompressibleFvPatchScalarField::write(Ostream& os) const +{ + fvPatchField::write(os); + os.writeEntry("Prt", Prt_); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + alphatWallFunctionIncompressibleFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/adjoint/boundaryConditions/alphatWallFunctionIncomp/alphatWallFunctionIncompFvPatchScalarField.H b/src/adjoint/boundaryConditions/alphatWallFunctionIncomp/alphatWallFunctionIncompFvPatchScalarField.H new file mode 100755 index 00000000..1793415c --- /dev/null +++ b/src/adjoint/boundaryConditions/alphatWallFunctionIncomp/alphatWallFunctionIncompFvPatchScalarField.H @@ -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 . + + 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& + ); + + //- Construct from patch, internal field and dictionary + alphatWallFunctionIncompressibleFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // alphatWallFunctionIncompressibleFvPatchScalarField + // onto a new patch + alphatWallFunctionIncompressibleFvPatchScalarField + ( + const alphatWallFunctionIncompressibleFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + alphatWallFunctionIncompressibleFvPatchScalarField + ( + const alphatWallFunctionIncompressibleFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new alphatWallFunctionIncompressibleFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + alphatWallFunctionIncompressibleFvPatchScalarField + ( + const alphatWallFunctionIncompressibleFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + 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 + +// ************************************************************************* //