diff --git a/src/rigidBodyState/rigidBodyState/rigidBodyState.C b/src/rigidBodyState/rigidBodyState/rigidBodyState.C index 017ed813e4..b4381bcede 100644 --- a/src/rigidBodyState/rigidBodyState/rigidBodyState.C +++ b/src/rigidBodyState/rigidBodyState/rigidBodyState.C @@ -88,7 +88,11 @@ bool Foam::functionObjects::rigidBodyState::read(const dictionary& dict) { fvMeshFunctionObject::read(dict); - angleUnits_ = dict.lookupOrDefault("angleUnits", "radians"); + angleUnits_ = dict.lookupOrDefaultBackwardsCompatible + ( + {"angleUnits", "angleFormat"}, + "radians" + ); resetNames(names_); diff --git a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/axialAngularSpring/axialAngularSpring.C b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/axialAngularSpring/axialAngularSpring.C index 8466d9d9b1..d3dd90d8e5 100644 --- a/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/axialAngularSpring/axialAngularSpring.C +++ b/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/axialAngularSpring/axialAngularSpring.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -177,20 +177,26 @@ bool Foam::sixDoFRigidBodyMotionRestraints::axialAngularSpring::read moment_ = Function1::New("moment", sDoFRBMRCoeffs_); - const word angleFormat = sDoFRBMRCoeffs_.lookup("angleFormat"); + const word angleUnits + ( + sDoFRBMRCoeffs_.lookupBackwardsCompatible + ( + {"angleUnits", "angleFormat"} + ) + ); - if (angleFormat == "degrees" || angleFormat == "degree") + if (angleUnits == "degrees" || angleUnits == "degree") { convertToDegrees_ = true; } - else if (angleFormat == "radians" || angleFormat == "radian") + else if (angleUnits == "radians" || angleUnits == "radian") { convertToDegrees_ = false; } else { FatalErrorInFunction - << "angleFormat must be degree, degrees, radian or radians" + << "angleUnits must be degree, degrees, radian or radians" << abort(FatalError); } @@ -211,7 +217,7 @@ void Foam::sixDoFRigidBodyMotionRestraints::axialAngularSpring::write moment_->write(os); - writeKeyword(os, "angleFormat"); + writeKeyword(os, "angleUnits"); if (convertToDegrees_) { diff --git a/src/sixDoFRigidBodyState/sixDoFRigidBodyControl/sixDoFRigidBodyControl.H b/src/sixDoFRigidBodyState/sixDoFRigidBodyControl/sixDoFRigidBodyControl.H index e44029c78a..811a876ea1 100644 --- a/src/sixDoFRigidBodyState/sixDoFRigidBodyControl/sixDoFRigidBodyControl.H +++ b/src/sixDoFRigidBodyState/sixDoFRigidBodyControl/sixDoFRigidBodyControl.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,7 +38,7 @@ Description type sixDoFRigidBodyControl; libs ("libsixDoFRigidBodyState.so"); - angleFormat degrees; + angleUnits degrees; window 1; convergedVelocity (1e-2 1e-2 1e-2); @@ -47,13 +47,13 @@ Description \endverbatim Note the units of the \c convergedAngularVelocity are specified by the \c - angleFormat entry. + angleUnits entry. Usage \table Property | Description | Required | Default value type | Type name: sixDoFRigidBodyControl | yes | - angleFormat | Degrees or radians | no | radian + angleUnits | Degrees or radians | no | radian window | Averaging window | yes | convergedVelocity | Linear velocity convergence criterion | yes | convergedAngularVelocity | Angular velocity convergence criterion | yes | diff --git a/src/sixDoFRigidBodyState/sixDoFRigidBodyState/sixDoFRigidBodyState.C b/src/sixDoFRigidBodyState/sixDoFRigidBodyState/sixDoFRigidBodyState.C index 66c97eeb89..6c70d94006 100644 --- a/src/sixDoFRigidBodyState/sixDoFRigidBodyState/sixDoFRigidBodyState.C +++ b/src/sixDoFRigidBodyState/sixDoFRigidBodyState/sixDoFRigidBodyState.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -77,7 +77,11 @@ bool Foam::functionObjects::sixDoFRigidBodyState::read(const dictionary& dict) { fvMeshFunctionObject::read(dict); - angleFormat_ = dict.lookupOrDefault("angleFormat", "radians"); + angleUnits_ = dict.lookupOrDefaultBackwardsCompatible + ( + {"angleUnits", "angleFormat"}, + "radians" + ); resetName(typeName); @@ -90,7 +94,7 @@ void Foam::functionObjects::sixDoFRigidBodyState::writeFileHeader(const label) OFstream& file = this->file(); writeHeader(file, "Motion State"); - writeHeaderValue(file, "Angle Units", angleFormat_); + writeHeaderValue(file, "Angle Units", angleUnits_); writeCommented(file, "Time"); file<< tab @@ -130,7 +134,7 @@ Foam::functionObjects::sixDoFRigidBodyState::angularVelocity() const { vector angularVelocity(motion().omega()); - if (angleFormat_ == "degrees") + if (angleUnits_ == "degrees") { angularVelocity.x() = radToDeg(angularVelocity.x()); angularVelocity.y() = radToDeg(angularVelocity.y()); @@ -156,7 +160,7 @@ bool Foam::functionObjects::sixDoFRigidBodyState::write() vector angularVelocity(motion.omega()); - if (angleFormat_ == "degrees") + if (angleUnits_ == "degrees") { rotationAngle.x() = radToDeg(rotationAngle.x()); rotationAngle.y() = radToDeg(rotationAngle.y()); diff --git a/src/sixDoFRigidBodyState/sixDoFRigidBodyState/sixDoFRigidBodyState.H b/src/sixDoFRigidBodyState/sixDoFRigidBodyState/sixDoFRigidBodyState.H index 7cbd2bc209..e720f33b48 100644 --- a/src/sixDoFRigidBodyState/sixDoFRigidBodyState/sixDoFRigidBodyState.H +++ b/src/sixDoFRigidBodyState/sixDoFRigidBodyState/sixDoFRigidBodyState.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,7 +33,7 @@ Description { type sixDoFRigidBodyState; libs ("libsixDoFRigidBodyState.so"); - angleFormat degrees; + angleUnits degrees; } \endverbatim @@ -41,7 +41,7 @@ Usage \table Property | Description | Required | Default value type | type name: sixDoFRigidBodyState | yes | - angleFormat | degrees or radians | no | radian + angleUnits | degrees or radians | no | radian \endtable See also @@ -80,7 +80,7 @@ class sixDoFRigidBodyState { // Private Data - word angleFormat_; + word angleUnits_; // Private Member Functions diff --git a/tutorials/modules/incompressibleFluid/wingMotion/wingMotion2D_transient/system/controlDict b/tutorials/modules/incompressibleFluid/wingMotion/wingMotion2D_transient/system/controlDict index 66413db8ea..e5fe700fdc 100644 --- a/tutorials/modules/incompressibleFluid/wingMotion/wingMotion2D_transient/system/controlDict +++ b/tutorials/modules/incompressibleFluid/wingMotion/wingMotion2D_transient/system/controlDict @@ -56,7 +56,7 @@ functions { type sixDoFRigidBodyState; libs ("libsixDoFRigidBodyState.so"); - angleFormat degrees; + angleUnits degrees; } } diff --git a/tutorials/multiphase/interFoam/RAS/floatingObject/system/controlDict b/tutorials/multiphase/interFoam/RAS/floatingObject/system/controlDict index 68e0e68c3c..1458f420f0 100644 --- a/tutorials/multiphase/interFoam/RAS/floatingObject/system/controlDict +++ b/tutorials/multiphase/interFoam/RAS/floatingObject/system/controlDict @@ -56,7 +56,7 @@ functions { type rigidBodyState; libs ("librigidBodyState.so"); - angleFormat degrees; + angleUnits degrees; } } diff --git a/tutorials/multiphase/interFoam/RAS/floatingObject/system/controlDict.sixDoF b/tutorials/multiphase/interFoam/RAS/floatingObject/system/controlDict.sixDoF index 69a5f5ac45..c015baca8f 100644 --- a/tutorials/multiphase/interFoam/RAS/floatingObject/system/controlDict.sixDoF +++ b/tutorials/multiphase/interFoam/RAS/floatingObject/system/controlDict.sixDoF @@ -56,7 +56,7 @@ functions { type sixDoFRigidBodyState; libs ("libsixDoFRigidBodyState.so"); - angleFormat degrees; + angleUnits degrees; } } diff --git a/tutorials/multiphase/interFoam/RAS/planingHullW3/system/controlDict b/tutorials/multiphase/interFoam/RAS/planingHullW3/system/controlDict index ba0a8f82dd..a7fb4f78db 100644 --- a/tutorials/multiphase/interFoam/RAS/planingHullW3/system/controlDict +++ b/tutorials/multiphase/interFoam/RAS/planingHullW3/system/controlDict @@ -67,7 +67,7 @@ functions { type rigidBodyState; libs ("librigidBodyState.so"); - angleFormat degrees; + angleUnits degrees; } #includeFunc surfaces