waveForcing: Added optional lambdaBoundary specification
which allows lambda to set higher in the cells adjacent to the boundary which is particularly useful when solving for waves in a domain with no mean-flow and wave BCs to avoid numerical stability problems where the specified wave flow reverses into the domain. The alternative is to use symmetry rather than wave BCs on the side patches which is stable without using lambdaBoundary but there is modest distortion of the wave profile adjacent to the side patches which does not propagate into the domain due to the wave forcing.
This commit is contained in:
@ -50,6 +50,14 @@ void Foam::fv::forcing::readCoeffs()
|
||||
coeffs().lookup(lambda_.name())
|
||||
);
|
||||
|
||||
lambdaBoundary_ =
|
||||
dimensionedScalar
|
||||
(
|
||||
lambdaBoundary_.name(),
|
||||
lambdaBoundary_.dimensions(),
|
||||
coeffs().lookupOrDefault(lambdaBoundary_.name(), 0)
|
||||
);
|
||||
|
||||
const bool foundScale = coeffs().found("scale");
|
||||
const bool foundOgn = coeffs().found("origin");
|
||||
const bool foundDir = coeffs().found("direction");
|
||||
@ -157,6 +165,22 @@ Foam::tmp<Foam::volScalarField::Internal> Foam::fv::forcing::forceCoeff
|
||||
volScalarField::Internal::New(typedName("forceCoeff"), lambda_*scale)
|
||||
);
|
||||
|
||||
// Damp the cells adjacent to the boundary with lambdaBoundary if specified
|
||||
if (lambdaBoundary_.value() > 0)
|
||||
{
|
||||
const fvBoundaryMesh& bm = mesh().boundary();
|
||||
|
||||
forAll(bm, patchi)
|
||||
{
|
||||
if (!bm[patchi].coupled())
|
||||
{
|
||||
UIndirectList<scalar>(tforceCoeff.ref(), bm[patchi].faceCells())
|
||||
= lambdaBoundary_.value()
|
||||
*Field<scalar>(scale, bm[patchi].faceCells());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Write out the force coefficient for debugging
|
||||
if (debug && mesh().time().writeTime())
|
||||
{
|
||||
@ -185,6 +209,7 @@ Foam::fv::forcing::forcing
|
||||
:
|
||||
fvModel(name, modelType, mesh, dict),
|
||||
lambda_("lambda", dimless/dimTime, NaN),
|
||||
lambdaBoundary_("lambdaBoundary", dimless/dimTime, 0),
|
||||
scale_(nullptr),
|
||||
origins_(),
|
||||
directions_()
|
||||
|
||||
@ -65,6 +65,9 @@ protected:
|
||||
//- Damping coefficient [1/s]
|
||||
dimensionedScalar lambda_;
|
||||
|
||||
//- Optional boundary damping coefficient [1/s]
|
||||
dimensionedScalar lambdaBoundary_;
|
||||
|
||||
//- The scaling function
|
||||
autoPtr<Function1<scalar>> scale_;
|
||||
|
||||
|
||||
@ -63,6 +63,10 @@ Usage
|
||||
}
|
||||
|
||||
lambda 0.5; // Forcing coefficient
|
||||
|
||||
// lambda 2; // Optional boundary forcing coefficient
|
||||
// Useful when wave BCs are specified
|
||||
// without mean flow
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
|
||||
@ -45,7 +45,8 @@ forcing
|
||||
duration 0.5;
|
||||
}
|
||||
|
||||
lambda 25;
|
||||
lambda 5;
|
||||
lambdaBoundary 25;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ functions0
|
||||
DebugSwitches
|
||||
{
|
||||
// Write the forcing and damping scale and force fields
|
||||
// forcing 1;
|
||||
forcing 1;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Reference in New Issue
Block a user