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()
|
||||
{
|
||||
writeForceFields_ = coeffs().lookupOrDefault("writeForceFields", false);
|
||||
|
||||
lambda_ =
|
||||
dimensionedScalar
|
||||
(
|
||||
@ -145,12 +147,6 @@ Foam::tmp<Foam::volScalarField::Internal> Foam::fv::forcing::scale() const
|
||||
scale = max(scale, scale_->value(x));
|
||||
}
|
||||
|
||||
// Write out the force coefficient for debugging
|
||||
if (debug && mesh().time().writeTime())
|
||||
{
|
||||
tscale->write();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -208,6 +198,7 @@ Foam::fv::forcing::forcing
|
||||
)
|
||||
:
|
||||
fvModel(name, modelType, mesh, dict),
|
||||
writeForceFields_(false),
|
||||
lambda_("lambda", dimless/dimTime, NaN),
|
||||
lambdaBoundary_("lambdaBoundary", dimless/dimTime, 0.0),
|
||||
scale_(nullptr),
|
||||
@ -215,6 +206,16 @@ Foam::fv::forcing::forcing
|
||||
directions_()
|
||||
{
|
||||
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
|
||||
|
||||
//- Damping coefficient [1/s]
|
||||
//- Optionally write the forcing fields
|
||||
bool writeForceFields_;
|
||||
|
||||
//- Forcing coefficient [1/s]
|
||||
dimensionedScalar lambda_;
|
||||
|
||||
//- Optional boundary damping coefficient [1/s]
|
||||
//- Optional boundary forcing coefficient [1/s]
|
||||
dimensionedScalar lambdaBoundary_;
|
||||
|
||||
//- The scaling function
|
||||
|
||||
@ -64,6 +64,9 @@ Usage
|
||||
value (2 0 0); // Value towards which the field is
|
||||
// relaxed
|
||||
lambda [0 0 -1 0 0 0 0] 1; // Damping coefficient
|
||||
|
||||
// Write the forcing fields: forcing:scale, forcing:forceCoeff
|
||||
writeForceFields true;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
|
||||
@ -78,6 +78,9 @@ Usage
|
||||
|
||||
timeStart 0;
|
||||
duration 1e6;
|
||||
|
||||
// Write the forcing fields: forcing:scale, forcing:forceCoeff
|
||||
writeForceFields true;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
|
||||
@ -64,9 +64,12 @@ Usage
|
||||
|
||||
lambda 0.5; // Forcing coefficient
|
||||
|
||||
// lambda 2; // Optional boundary 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;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
|
||||
@ -47,6 +47,9 @@ forcing
|
||||
|
||||
lambda 5;
|
||||
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