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 |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -92,6 +93,38 @@ movingWallVelocityFvPatchVectorField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::vectorField>
Foam::movingWallVelocityFvPatchVectorField::Uwall() const
{
const fvMesh& mesh = internalField().mesh();
const fvPatch& p = patch();
const polyPatch& pp = p.patch();
const pointField& oldPoints = mesh.oldPoints();
vectorField oldFc(pp.size());
forAll(oldFc, i)
{
oldFc[i] = pp[i].centre(oldPoints);
}
const scalar deltaT = mesh.time().deltaTValue();
const vectorField Up((pp.faceCentres() - oldFc)/deltaT);
const auto& U = static_cast<const volVectorField&>(internalField());
tmp<scalarField> phip =
p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U));
const vectorField n(p.nf());
const scalarField& magSf = p.magSf();
tmp<scalarField> Un = phip/(magSf + VSMALL);
return (Up + n*(Un - (n & Up)));
}
void Foam::movingWallVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
@ -103,35 +136,7 @@ void Foam::movingWallVelocityFvPatchVectorField::updateCoeffs()
if (mesh.moving())
{
const fvPatch& p = patch();
const polyPatch& pp = p.patch();
const pointField& oldPoints = mesh.oldPoints();
vectorField oldFc(pp.size());
forAll(oldFc, i)
{
oldFc[i] = pp[i].centre(oldPoints);
}
const scalar deltaT = mesh.time().deltaTValue();
const vectorField Up((pp.faceCentres() - oldFc)/deltaT);
const volVectorField& U =
static_cast<const volVectorField&>(internalField());
scalarField phip
(
p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U))
);
const vectorField n(p.nf());
const scalarField& magSf = p.magSf();
tmp<scalarField> Un = phip/(magSf + VSMALL);
vectorField::operator=(Up + n*(Un - (n & Up)));
vectorField::operator=(Uwall()());
}
fixedValueFvPatchVectorField::updateCoeffs();

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2015 OpenCFD Ltd.
Copyright (C) 2015-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -71,7 +71,6 @@ class movingWallVelocityFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
public:
//- 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
virtual void updateCoeffs();