mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: movingWallVelocity: add Uwall function
This commit is contained in:
@ -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,6 +93,38 @@ movingWallVelocityFvPatchVectorField
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * 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()
|
void Foam::movingWallVelocityFvPatchVectorField::updateCoeffs()
|
||||||
{
|
{
|
||||||
if (updated())
|
if (updated())
|
||||||
@ -103,35 +136,7 @@ void Foam::movingWallVelocityFvPatchVectorField::updateCoeffs()
|
|||||||
|
|
||||||
if (mesh.moving())
|
if (mesh.moving())
|
||||||
{
|
{
|
||||||
const fvPatch& p = patch();
|
vectorField::operator=(Uwall()());
|
||||||
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)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fixedValueFvPatchVectorField::updateCoeffs();
|
fixedValueFvPatchVectorField::updateCoeffs();
|
||||||
|
|||||||
@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user