Skip to content
Snippets Groups Projects
Commit b006f5c4 authored by sergio's avatar sergio Committed by Sergio Ferraris
Browse files

ENH: movingWallVelocity: add Uwall function

parent ce5e2e7e
No related branches found
No related tags found
1 merge request!475finiteArea: new models and solvers for films
...@@ -6,6 +6,7 @@ ...@@ -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,46 +93,50 @@ movingWallVelocityFvPatchVectorField ...@@ -92,46 +93,50 @@ 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();
const fvPatch& p = patch();
const polyPatch& pp = p.patch();
const pointField& oldPoints = mesh.oldPoints();
if (mesh.moving()) vectorField oldFc(pp.size());
forAll(oldFc, i)
{ {
const fvPatch& p = patch(); oldFc[i] = pp[i].centre(oldPoints);
const polyPatch& pp = p.patch(); }
const pointField& oldPoints = mesh.oldPoints();
const scalar deltaT = mesh.time().deltaTValue();
vectorField oldFc(pp.size()); const vectorField Up((pp.faceCentres() - oldFc)/deltaT);
forAll(oldFc, i) const auto& U = static_cast<const volVectorField&>(internalField());
{
oldFc[i] = pp[i].centre(oldPoints);
}
const scalar deltaT = mesh.time().deltaTValue(); tmp<scalarField> phip =
p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U));
const vectorField Up((pp.faceCentres() - oldFc)/deltaT); const vectorField n(p.nf());
const scalarField& magSf = p.magSf();
tmp<scalarField> Un = phip/(magSf + VSMALL);
const volVectorField& U = return (Up + n*(Un - (n & Up)));
static_cast<const volVectorField&>(internalField()); }
scalarField phip
(
p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U))
);
const vectorField n(p.nf()); void Foam::movingWallVelocityFvPatchVectorField::updateCoeffs()
const scalarField& magSf = p.magSf(); {
tmp<scalarField> Un = phip/(magSf + VSMALL); if (updated())
{
return;
}
const fvMesh& mesh = internalField().mesh();
vectorField::operator=(Up + n*(Un - (n & Up))); if (mesh.moving())
{
vectorField::operator=(Uwall()());
} }
fixedValueFvPatchVectorField::updateCoeffs(); fixedValueFvPatchVectorField::updateCoeffs();
......
...@@ -6,7 +6,7 @@ ...@@ -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 ...@@ -71,7 +71,6 @@ class movingWallVelocityFvPatchVectorField
: :
public fixedValueFvPatchVectorField public fixedValueFvPatchVectorField
{ {
public: public:
//- Runtime type information //- Runtime type information
...@@ -140,7 +139,10 @@ public: ...@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment