mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: waveModels - refactored time scaling coefficient
This commit is contained in:
@ -41,6 +41,15 @@ namespace waveModels
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::scalar Foam::waveModels::regularWaveModel::timeCoeff
|
||||
(
|
||||
const scalar t
|
||||
) const
|
||||
{
|
||||
return max(0, min(t/rampTime_, 1));
|
||||
}
|
||||
|
||||
|
||||
Foam::word Foam::waveModels::regularWaveModel::waveType() const
|
||||
{
|
||||
scalar waveK = 2.0*mathematical::pi/waveLength_;
|
||||
@ -70,6 +79,7 @@ Foam::waveModels::regularWaveModel::regularWaveModel
|
||||
)
|
||||
:
|
||||
waveGenerationModel(dict, mesh, patch, false),
|
||||
rampTime_(VSMALL),
|
||||
wavePeriod_(0),
|
||||
waveLength_(0),
|
||||
wavePhase_(1.5*mathematical::pi)
|
||||
@ -93,6 +103,8 @@ bool Foam::waveModels::regularWaveModel::read(const dictionary& overrideDict)
|
||||
{
|
||||
if (waveGenerationModel::read(overrideDict))
|
||||
{
|
||||
lookup("rampTime") >> rampTime_;
|
||||
|
||||
lookup("wavePeriod") >> wavePeriod_;
|
||||
if (wavePeriod_ < 0)
|
||||
{
|
||||
@ -117,7 +129,8 @@ void Foam::waveModels::regularWaveModel::info(Ostream& os) const
|
||||
{
|
||||
waveGenerationModel::info(os);
|
||||
|
||||
os << " Wave period : " << wavePeriod_ << nl
|
||||
os << " Ramp time : " << rampTime_ << nl
|
||||
<< " Wave period : " << wavePeriod_ << nl
|
||||
<< " Wave length : " << waveLength_ << nl
|
||||
<< " Wave phase : " << wavePhase_ << nl;
|
||||
}
|
||||
|
||||
@ -61,6 +61,9 @@ protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Ramp time
|
||||
scalar rampTime_;
|
||||
|
||||
//- Wave period
|
||||
scalar wavePeriod_;
|
||||
|
||||
@ -73,8 +76,11 @@ protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Return the time scaling coefficient
|
||||
virtual scalar timeCoeff(const scalar t) const;
|
||||
|
||||
//- Return word description of wave type
|
||||
word waveType() const;
|
||||
virtual word waveType() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -27,6 +27,8 @@ License
|
||||
#include "polyPatch.H"
|
||||
#include "SubField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace waveModels
|
||||
@ -36,6 +38,18 @@ namespace waveModels
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::scalar Foam::waveModels::solitaryWaveModel::timeCoeff
|
||||
(
|
||||
const scalar t
|
||||
) const
|
||||
{
|
||||
// Ramping not applicable to solitary waves
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::waveModels::solitaryWaveModel::solitaryWaveModel
|
||||
|
||||
@ -59,6 +59,12 @@ protected:
|
||||
const scalar x0_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Return the time scaling coefficient
|
||||
virtual scalar timeCoeff(const scalar t) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
|
||||
@ -72,7 +72,6 @@ bool Foam::waveModels::waveGenerationModel::read(const dictionary& overrideDict)
|
||||
{
|
||||
if (waveModel::read(overrideDict))
|
||||
{
|
||||
lookup("rampTime") >> rampTime_;
|
||||
lookup("activeAbsorption") >> activeAbsorption_;
|
||||
|
||||
lookup("waveHeight") >> waveHeight_;
|
||||
@ -98,8 +97,7 @@ void Foam::waveModels::waveGenerationModel::info(Ostream& os) const
|
||||
{
|
||||
waveModel::info(os);
|
||||
|
||||
os << " Ramp time : " << rampTime_ << nl
|
||||
<< " Wave height : " << waveHeight_ << nl
|
||||
os << " Wave height : " << waveHeight_ << nl
|
||||
<< " Wave angle : " << 180/mathematical::pi*waveAngle_ << nl;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user