waves::fvModels::forcing: Added option to write the forcing fields
e.g.
waveForcing1
{
type waveForcing;
libs ("libwaves.so");
liquidPhase water;
// Define the line along which to apply the graduation
origin (600 0 0);
direction (-1 0 0);
// // Or, define multiple lines
// origins ((600 0 0) (600 -300 0) (600 300 0));
// directions ((-1 0 0) (0 1 0) (0 -1 0));
scale
{
type halfCosineRamp;
start 0;
duration 300;
}
lambda 0.5; // Forcing coefficient
// lambdaBoundary 2; // Optional boundary forcing coefficient
// Useful when wave BCs are specified
// without mean flow
// Write the forcing fields: forcing:scale, forcing:forceCoeff
writeForceFields true;
}
will write the fields forcing:scale and forcing:forceCoeff at the start of the
run to visualise and check correctness.
This commit is contained in:
@ -42,6 +42,8 @@ namespace fv
|
|||||||
|
|
||||||
void Foam::fv::forcing::readCoeffs()
|
void Foam::fv::forcing::readCoeffs()
|
||||||
{
|
{
|
||||||
|
writeForceFields_ = coeffs().lookupOrDefault("writeForceFields", false);
|
||||||
|
|
||||||
lambda_ =
|
lambda_ =
|
||||||
dimensionedScalar
|
dimensionedScalar
|
||||||
(
|
(
|
||||||
@ -145,12 +147,6 @@ Foam::tmp<Foam::volScalarField::Internal> Foam::fv::forcing::scale() const
|
|||||||
scale = max(scale, scale_->value(x));
|
scale = max(scale, scale_->value(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write out the force coefficient for debugging
|
|
||||||
if (debug && mesh().time().writeTime())
|
|
||||||
{
|
|
||||||
tscale->write();
|
|
||||||
}
|
|
||||||
|
|
||||||
return tscale;
|
return tscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,12 +177,6 @@ Foam::tmp<Foam::volScalarField::Internal> Foam::fv::forcing::forceCoeff
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write out the force coefficient for debugging
|
|
||||||
if (debug && mesh().time().writeTime())
|
|
||||||
{
|
|
||||||
tforceCoeff->write();
|
|
||||||
}
|
|
||||||
|
|
||||||
return tforceCoeff;
|
return tforceCoeff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,6 +198,7 @@ Foam::fv::forcing::forcing
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fvModel(name, modelType, mesh, dict),
|
fvModel(name, modelType, mesh, dict),
|
||||||
|
writeForceFields_(false),
|
||||||
lambda_("lambda", dimless/dimTime, NaN),
|
lambda_("lambda", dimless/dimTime, NaN),
|
||||||
lambdaBoundary_("lambdaBoundary", dimless/dimTime, 0.0),
|
lambdaBoundary_("lambdaBoundary", dimless/dimTime, 0.0),
|
||||||
scale_(nullptr),
|
scale_(nullptr),
|
||||||
@ -215,6 +206,16 @@ Foam::fv::forcing::forcing
|
|||||||
directions_()
|
directions_()
|
||||||
{
|
{
|
||||||
readCoeffs();
|
readCoeffs();
|
||||||
|
|
||||||
|
if (writeForceFields_)
|
||||||
|
{
|
||||||
|
Info<< " Writing forcing fields: forcing:scale, forcing:forceCoeff"
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
const volScalarField::Internal scale(this->scale());
|
||||||
|
scale.write();
|
||||||
|
forceCoeff(scale)->write();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -62,10 +62,13 @@ protected:
|
|||||||
|
|
||||||
// Protected Data
|
// Protected Data
|
||||||
|
|
||||||
//- Damping coefficient [1/s]
|
//- Optionally write the forcing fields
|
||||||
|
bool writeForceFields_;
|
||||||
|
|
||||||
|
//- Forcing coefficient [1/s]
|
||||||
dimensionedScalar lambda_;
|
dimensionedScalar lambda_;
|
||||||
|
|
||||||
//- Optional boundary damping coefficient [1/s]
|
//- Optional boundary forcing coefficient [1/s]
|
||||||
dimensionedScalar lambdaBoundary_;
|
dimensionedScalar lambdaBoundary_;
|
||||||
|
|
||||||
//- The scaling function
|
//- The scaling function
|
||||||
|
|||||||
@ -64,6 +64,9 @@ Usage
|
|||||||
value (2 0 0); // Value towards which the field is
|
value (2 0 0); // Value towards which the field is
|
||||||
// relaxed
|
// relaxed
|
||||||
lambda [0 0 -1 0 0 0 0] 1; // Damping coefficient
|
lambda [0 0 -1 0 0 0 0] 1; // Damping coefficient
|
||||||
|
|
||||||
|
// Write the forcing fields: forcing:scale, forcing:forceCoeff
|
||||||
|
writeForceFields true;
|
||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
|
|||||||
@ -78,6 +78,9 @@ Usage
|
|||||||
|
|
||||||
timeStart 0;
|
timeStart 0;
|
||||||
duration 1e6;
|
duration 1e6;
|
||||||
|
|
||||||
|
// Write the forcing fields: forcing:scale, forcing:forceCoeff
|
||||||
|
writeForceFields true;
|
||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
|
|||||||
@ -64,9 +64,12 @@ Usage
|
|||||||
|
|
||||||
lambda 0.5; // Forcing coefficient
|
lambda 0.5; // Forcing coefficient
|
||||||
|
|
||||||
// lambda 2; // Optional boundary forcing coefficient
|
// lambdaBoundary 2; // Optional boundary forcing coefficient
|
||||||
// Useful when wave BCs are specified
|
// Useful when wave BCs are specified
|
||||||
// without mean flow
|
// without mean flow
|
||||||
|
|
||||||
|
// Write the forcing fields: forcing:scale, forcing:forceCoeff
|
||||||
|
writeForceFields true;
|
||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
|
|||||||
@ -47,6 +47,9 @@ forcing
|
|||||||
|
|
||||||
lambda 5;
|
lambda 5;
|
||||||
lambdaBoundary 25;
|
lambdaBoundary 25;
|
||||||
|
|
||||||
|
// Write the forcing fields: forcing:scale, forcing:forceCoeff
|
||||||
|
writeForceFields true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -62,10 +62,4 @@ functions0
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugSwitches
|
|
||||||
{
|
|
||||||
// Write the forcing and damping scale and force fields
|
|
||||||
forcing 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
Reference in New Issue
Block a user