ENH: movingWallVelocity: add Uwall function

This commit is contained in:
sergio
2021-07-13 11:52:55 +01:00
committed by Sergio Ferraris
parent ce5e2e7e1c
commit b006f5c44e
2 changed files with 39 additions and 32 deletions

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -92,17 +93,10 @@ movingWallVelocityFvPatchVectorField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::movingWallVelocityFvPatchVectorField::updateCoeffs() Foam::tmp<Foam::vectorField>
Foam::movingWallVelocityFvPatchVectorField::Uwall() const
{ {
if (updated())
{
return;
}
const fvMesh& mesh = internalField().mesh(); const fvMesh& mesh = internalField().mesh();
if (mesh.moving())
{
const fvPatch& p = patch(); const fvPatch& p = patch();
const polyPatch& pp = p.patch(); const polyPatch& pp = p.patch();
const pointField& oldPoints = mesh.oldPoints(); const pointField& oldPoints = mesh.oldPoints();
@ -118,20 +112,31 @@ void Foam::movingWallVelocityFvPatchVectorField::updateCoeffs()
const vectorField Up((pp.faceCentres() - oldFc)/deltaT); const vectorField Up((pp.faceCentres() - oldFc)/deltaT);
const volVectorField& U = const auto& U = static_cast<const volVectorField&>(internalField());
static_cast<const volVectorField&>(internalField());
scalarField phip tmp<scalarField> phip =
( p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U));
p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U))
);
const vectorField n(p.nf()); const vectorField n(p.nf());
const scalarField& magSf = p.magSf(); const scalarField& magSf = p.magSf();
tmp<scalarField> Un = phip/(magSf + VSMALL); tmp<scalarField> Un = phip/(magSf + VSMALL);
return (Up + n*(Un - (n & Up)));
}
vectorField::operator=(Up + n*(Un - (n & Up)));
void Foam::movingWallVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
const fvMesh& mesh = internalField().mesh();
if (mesh.moving())
{
vectorField::operator=(Uwall()());
} }
fixedValueFvPatchVectorField::updateCoeffs(); fixedValueFvPatchVectorField::updateCoeffs();

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2015 OpenCFD Ltd. Copyright (C) 2015-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -71,7 +71,6 @@ class movingWallVelocityFvPatchVectorField
: :
public fixedValueFvPatchVectorField public fixedValueFvPatchVectorField
{ {
public: public:
//- Runtime type information //- Runtime type information
@ -140,7 +139,10 @@ public:
} }
// Member functions // Member Functions
//- Return wall velocity field
tmp<vectorField> Uwall() const;
//- Update the coefficients associated with the patch field //- Update the coefficients associated with the patch field
virtual void updateCoeffs(); virtual void updateCoeffs();