diff --git a/src/waves/fvModels/forcing/forcing.C b/src/waves/fvModels/forcing/forcing.C index c85f326192..6f36f0cd94 100644 --- a/src/waves/fvModels/forcing/forcing.C +++ b/src/waves/fvModels/forcing/forcing.C @@ -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::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::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(); + } } diff --git a/src/waves/fvModels/forcing/forcing.H b/src/waves/fvModels/forcing/forcing.H index 989d18de82..74c0aac7f9 100644 --- a/src/waves/fvModels/forcing/forcing.H +++ b/src/waves/fvModels/forcing/forcing.H @@ -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 diff --git a/src/waves/fvModels/isotropicDamping/isotropicDamping.H b/src/waves/fvModels/isotropicDamping/isotropicDamping.H index e9c9938da0..43f870fc41 100644 --- a/src/waves/fvModels/isotropicDamping/isotropicDamping.H +++ b/src/waves/fvModels/isotropicDamping/isotropicDamping.H @@ -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 diff --git a/src/waves/fvModels/verticalDamping/verticalDamping.H b/src/waves/fvModels/verticalDamping/verticalDamping.H index 0c77667ecc..a7007bbe3b 100644 --- a/src/waves/fvModels/verticalDamping/verticalDamping.H +++ b/src/waves/fvModels/verticalDamping/verticalDamping.H @@ -78,6 +78,9 @@ Usage timeStart 0; duration 1e6; + + // Write the forcing fields: forcing:scale, forcing:forceCoeff + writeForceFields true; } \endverbatim diff --git a/src/waves/fvModels/waveForcing/waveForcing.H b/src/waves/fvModels/waveForcing/waveForcing.H index 304dcce003..695204580b 100644 --- a/src/waves/fvModels/waveForcing/waveForcing.H +++ b/src/waves/fvModels/waveForcing/waveForcing.H @@ -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 diff --git a/tutorials/incompressibleVoF/floatingObjectWaves/constant/fvModels b/tutorials/incompressibleVoF/floatingObjectWaves/constant/fvModels index 870980f48d..e278f77855 100644 --- a/tutorials/incompressibleVoF/floatingObjectWaves/constant/fvModels +++ b/tutorials/incompressibleVoF/floatingObjectWaves/constant/fvModels @@ -47,6 +47,9 @@ forcing lambda 5; lambdaBoundary 25; + + // Write the forcing fields: forcing:scale, forcing:forceCoeff + writeForceFields true; } diff --git a/tutorials/incompressibleVoF/floatingObjectWaves/system/controlDict b/tutorials/incompressibleVoF/floatingObjectWaves/system/controlDict index c3dac56239..f9794a79d8 100644 --- a/tutorials/incompressibleVoF/floatingObjectWaves/system/controlDict +++ b/tutorials/incompressibleVoF/floatingObjectWaves/system/controlDict @@ -62,10 +62,4 @@ functions0 } } -DebugSwitches -{ - // Write the forcing and damping scale and force fields - forcing 1; -} - // ************************************************************************* //