Skip to content

Commit

Permalink
filmSurfaceVelocityFvPatchVectorField: New film surface boundary cond…
Browse files Browse the repository at this point in the history
…ition

Class
    Foam::filmSurfaceVelocityFvPatchVectorField

Description
    Film surface velocity boundary condition

    Evaluates the surface velocity from the shear imposed by the neighbouring
    fluid velocity using a simple drag model based on the difference between the
    fluid and film velocities multiplied by the coefficient \c Cs.  This simple
    model is used in preference to the standard viscous shear stress model in
    order to provide some means to include the drag enhancing effect
    of surface ripples, rivulets etc. in the film surface.

Usage
    \table
        Property     | Description             | Required    | Default value
        Cs           | Fluid-film drag coefficient | yes |
    \endtable

    Example of the boundary condition specification:
    \verbatim
    <patchName>
    {
        type            filmSurfaceVelocity;
        Cs              0.005;
    }
    \endverbatim
  • Loading branch information
Henry Weller committed Mar 6, 2023
1 parent 03cafc6 commit 423fa5b
Show file tree
Hide file tree
Showing 4 changed files with 350 additions and 2 deletions.
1 change: 1 addition & 0 deletions applications/solvers/modules/isothermalFilm/Make/files
Expand Up @@ -19,6 +19,7 @@ patches/mappedFilmSurface/mappedFilmSurfaceFvPatch/mappedFilmSurfaceFvPatch.C
derivedFvPatchFields/alphaOne/alphaOneFvPatchScalarField.C
derivedFvPatchFields/filmContactAngle/filmContactAngleFvPatchScalarField.C
derivedFvPatchFields/mappedFilmPressure/mappedFilmPressureFvPatchScalarField.C
derivedFvPatchFields/filmSurfaceVelocity/filmSurfaceVelocityFvPatchVectorField.C

filmGaussGrad/filmGaussGrads.C

Expand Down
@@ -0,0 +1,182 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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 "filmSurfaceVelocityFvPatchVectorField.H"
#include "momentumTransportModel.H"
#include "mappedPatchBase.H"
#include "addToRunTimeSelectionTable.H"

// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

Foam::filmSurfaceVelocityFvPatchVectorField::
filmSurfaceVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
mixedFvPatchField<vector>(p, iF),
Cs_(0)
{
refValue() = Zero;
refGrad() = Zero;
valueFraction() = 0;
}


Foam::filmSurfaceVelocityFvPatchVectorField::
filmSurfaceVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
mixedFvPatchField<vector>(p, iF, dict, false),
Cs_(dict.lookup<scalar>("Cs"))
{
refValue() = Zero;
refGrad() = Zero;
valueFraction() = 0;

if (dict.found("value"))
{
fvPatchVectorField::operator=
(
vectorField("value", dict, p.size())
);
}
else
{
// If the value entry is not present initialise to zero-gradient
fvPatchVectorField::operator=(patchInternalField());
}
}


Foam::filmSurfaceVelocityFvPatchVectorField::
filmSurfaceVelocityFvPatchVectorField
(
const filmSurfaceVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mixedFvPatchField<vector>(ptf, p, iF, mapper),
Cs_(ptf.Cs_)
{}


Foam::filmSurfaceVelocityFvPatchVectorField::
filmSurfaceVelocityFvPatchVectorField
(
const filmSurfaceVelocityFvPatchVectorField& ptf,
const DimensionedField<vector, volMesh>& iF
)
:
mixedFvPatchField<vector>(ptf, iF),
Cs_(ptf.Cs_)
{}


// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

void Foam::filmSurfaceVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}

// Since we're inside initEvaluate/evaluate there might be processor
// comms underway. Change the tag we use.
const int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag + 1;

// Get the coupling information from the mappedPatchBase
const mappedPatchBase& mpp = mappedPatchBase::getMap(patch().patch());
const label patchiNbr = mpp.nbrPolyPatch().index();
const fvPatch& patchNbr =
refCast<const fvMesh>(mpp.nbrMesh()).boundary()[patchiNbr];

const vectorField UpNbr =
patchNbr.lookupPatchField<volVectorField, scalar>("U")
.patchInternalField();

// Set the reference value to the neighbouring fluid internal velocity
refValue() = mpp.distribute(UpNbr);

// Remove the normal component of the surface vel
const vectorField n(patch().nf());
refValue() -= n*(n & refValue());

// Lookup the momentum transport model
const momentumTransportModel& transportModel =
db().lookupType<momentumTransportModel>();

// Get the patch laminar viscosity
const tmp<scalarField> nuEff(transportModel.nuEff(patch().index()));

// Calculate the drag coefficient from the drag constant
// and the magnitude of the velocity difference
const scalarField Ds(Cs_*mag(refValue() - *this));

// Calculate the value-fraction from the balance between the
// external fluid drag and internal film stress
valueFraction() = Ds/(Ds + patch().deltaCoeffs()*nuEff);

mixedFvPatchField<vector>::updateCoeffs();

// Restore tag
UPstream::msgType() = oldTag;
}


void Foam::filmSurfaceVelocityFvPatchVectorField::write
(
Ostream& os
) const
{
fvPatchField<vector>::write(os);

writeEntry(os, "Cs", Cs_);
writeEntry(os, "value", *this);
}


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
filmSurfaceVelocityFvPatchVectorField
);
}


// ************************************************************************* //
@@ -0,0 +1,165 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2023 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::filmSurfaceVelocityFvPatchVectorField
Description
Film surface velocity boundary condition
Evaluates the surface velocity from the shear imposed by the neighbouring
fluid velocity using a simple drag model based on the difference between the
fluid and film velocities multiplied by the coefficient \c Cs. This simple
model is used in preference to the standard viscous shear stress model in
order to provide some means to include the drag enhancing effect
of surface ripples, rivulets etc. in the film surface.
Usage
\table
Property | Description | Required | Default value
Cs | Fluid-film drag coefficient | yes |
\endtable
Example of the boundary condition specification:
\verbatim
<patchName>
{
type filmSurfaceVelocity;
Cs 0.005;
}
\endverbatim
See also
Foam::mixedFvPatchField
SourceFiles
filmSurfaceVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/

#ifndef filmSurfaceVelocityFvPatchVectorField_H
#define filmSurfaceVelocityFvPatchVectorField_H

#include "mixedFvPatchFields.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
/*---------------------------------------------------------------------------*\
Class filmSurfaceVelocityFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/

class filmSurfaceVelocityFvPatchVectorField
:
public mixedFvPatchVectorField
{
// Private Data

//- Fluid-film drag-coefficient
scalar Cs_;


public:

//- Runtime type information
TypeName("filmSurfaceVelocity");


// Constructors

//- Construct from patch and internal field
filmSurfaceVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);

//- Construct from patch, internal field and dictionary
filmSurfaceVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);

//- Construct by mapping given
// filmSurfaceVelocityFvPatchVectorField
// onto a new patch
filmSurfaceVelocityFvPatchVectorField
(
const filmSurfaceVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);

//- Disallow copy without setting internal field reference
filmSurfaceVelocityFvPatchVectorField
(
const filmSurfaceVelocityFvPatchVectorField&
) = delete;

//- Copy constructor setting internal field reference
filmSurfaceVelocityFvPatchVectorField
(
const filmSurfaceVelocityFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);

//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchVectorField> clone
(
const DimensionedField<vector, volMesh>& iF
) const
{
return tmp<fvPatchVectorField>
(
new filmSurfaceVelocityFvPatchVectorField
(
*this,
iF
)
);
}


// Member Functions

//- Update the coefficients associated with the patch field
virtual void updateCoeffs();

//- Write
virtual void write(Ostream&) const;
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //
Expand Up @@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
Expand Down Expand Up @@ -93,7 +93,7 @@ void Foam::fixedShearStressFvPatchVectorField::updateCoeffs()
const momentumTransportModel& turbModel =
db().lookupType<momentumTransportModel>(internalField().group());

scalarField nuEff(turbModel.nuEff(patch().index()));
const scalarField nuEff(turbModel.nuEff(patch().index()));

const vectorField Uc(patchInternalField());

Expand Down

0 comments on commit 423fa5b

Please sign in to comment.