Commit 0e7920ef authored by Andrew Heather's avatar Andrew Heather
Browse files

Merge branch 'feature-acceleration-relaxation' into 'develop'

ENH: rigidBodyMotion: new Function1-type accelerationRelaxation

See merge request !520
parents 18dd013e 208aee14
......@@ -40,7 +40,7 @@ heatTransfer
{
T
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
value ${:VALUE.T};
Tnbr T;
kappaMethod fluidThermo;
......
......@@ -57,7 +57,7 @@ heatTransfer
{
T
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
value ${:VALUE.T};
Tnbr T;
kappaMethod fluidThermo;
......
......@@ -36,7 +36,7 @@ heatTransfer
{
T
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
value ${:VALUE.T};
Tnbr T;
kappaMethod solidThermo;
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -50,7 +50,7 @@ Foam::RBD::rigidBodyMotion::rigidBodyMotion(const Time& time)
rigidBodyModel(time),
motionState_(*this),
motionState0_(*this),
aRelax_(1.0),
aRelax_(nullptr),
aDamp_(1.0),
report_(false),
solver_(nullptr)
......@@ -66,7 +66,16 @@ Foam::RBD::rigidBodyMotion::rigidBodyMotion
motionState_(*this, dict),
motionState0_(motionState_),
X00_(X0_.size()),
aRelax_(dict.getOrDefault<scalar>("accelerationRelaxation", 1)),
aRelax_
(
Function1<scalar>::NewIfPresent
(
"accelerationRelaxation",
dict,
word::null,
&time
)
),
aDamp_(dict.getOrDefault<scalar>("accelerationDamping", 1)),
report_(dict.getOrDefault<Switch>("report", false)),
solver_(rigidBodySolver::New(*this, dict.subDict("solver")))
......@@ -91,7 +100,16 @@ Foam::RBD::rigidBodyMotion::rigidBodyMotion
motionState_(*this, stateDict),
motionState0_(motionState_),
X00_(X0_.size()),
aRelax_(dict.getOrDefault<scalar>("accelerationRelaxation", 1)),
aRelax_
(
Function1<scalar>::NewIfPresent
(
"accelerationRelaxation",
dict,
word::null,
&time
)
),
aDamp_(dict.getOrDefault<scalar>("accelerationDamping", 1)),
report_(dict.getOrDefault<Switch>("report", false)),
solver_(rigidBodySolver::New(*this, dict.subDict("solver")))
......@@ -139,7 +157,14 @@ void Foam::RBD::rigidBodyMotion::forwardDynamics
{
scalarField qDdotPrev = state.qDdot();
rigidBodyModel::forwardDynamics(state, tau, fx);
state.qDdot() = aDamp_*(aRelax_*state.qDdot() + (1 - aRelax_)*qDdotPrev);
scalar aRelax = 1;
if (aRelax_)
{
aRelax = aRelax_->value(motionState_.t());
}
state.qDdot() = aDamp_*(aRelax*state.qDdot() + (1 - aRelax)*qDdotPrev);
}
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -52,6 +53,7 @@ SourceFiles
#include "rigidBodyModelState.H"
#include "pointField.H"
#include "Switch.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -89,7 +91,7 @@ class rigidBodyMotion
List<spatialTransform> X00_;
//- Acceleration relaxation coefficient
scalar aRelax_;
autoPtr<Function1<scalar>> aRelax_;
//- Acceleration damping coefficient (for steady-state simulations)
scalar aDamp_;
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -33,13 +33,23 @@ License
bool Foam::RBD::rigidBodyMotion::read(const dictionary& dict)
{
rigidBodyModel::read(dict);
if (rigidBodyModel::read(dict))
{
aRelax_ =
Function1<scalar>::NewIfPresent
(
"accelerationRelaxation",
dict,
word::null,
&time()
);
aDamp_ = dict.getOrDefault<scalar>("accelerationDamping", 1);
report_ = dict.getOrDefault<Switch>("report", false);
aRelax_ = dict.getOrDefault<scalar>("accelerationRelaxation", 1);
aDamp_ = dict.getOrDefault<scalar>("accelerationDamping", 1);
report_ = dict.getOrDefault<Switch>("report", false);
return true;
}
return true;
return false;
}
......@@ -47,7 +57,10 @@ void Foam::RBD::rigidBodyMotion::write(Ostream& os) const
{
rigidBodyModel::write(os);
os.writeEntry("accelerationRelaxation", aRelax_);
if (aRelax_)
{
aRelax_->writeData(os);
}
os.writeEntry("accelerationDamping", aDamp_);
os.writeEntry("report", report_);
}
......
......@@ -262,10 +262,6 @@ addLayersControls
// Per final patch (so not geometry!) the layer information
layers
{
"blade."
{
nSurfaceLayers 2;
}
}
// Expansion factor for layer mesh
......
......@@ -66,7 +66,7 @@ T
"bottomWater_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod fluidThermo;
value uniform 300;
......
......@@ -44,7 +44,7 @@ T
}
"heater_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod solidThermo;
value uniform 300;
......@@ -52,7 +52,7 @@ T
heater_to_leftSolid
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod solidThermo;
thicknessLayers (1e-3);
......
......@@ -39,7 +39,7 @@ T
}
"leftSolid_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod solidThermo;
value uniform 300;
......@@ -47,7 +47,7 @@ T
leftSolid_to_heater
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod solidThermo;
thicknessLayers (1e-3);
......
......@@ -39,7 +39,7 @@ T
}
"rightSolid_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod solidThermo;
value uniform 300;
......
......@@ -72,7 +72,7 @@ T
"topAir_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod fluidThermo;
value uniform 300;
......
......@@ -66,7 +66,7 @@ T
"bottomWater_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod fluidThermo;
value uniform 300;
......
......@@ -44,7 +44,7 @@ T
}
"heater_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod solidThermo;
value uniform 300;
......@@ -52,7 +52,7 @@ T
heater_to_leftSolid
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod solidThermo;
thicknessLayers (1e-3);
......
......@@ -39,7 +39,7 @@ T
}
"leftSolid_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod solidThermo;
value uniform 300;
......@@ -47,7 +47,7 @@ T
leftSolid_to_heater
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod solidThermo;
thicknessLayers (1e-3);
......
......@@ -39,7 +39,7 @@ T
}
"rightSolid_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod solidThermo;
value uniform 300;
......
......@@ -72,7 +72,7 @@ T
"topAir_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod fluidThermo;
value uniform 300;
......
......@@ -37,7 +37,7 @@ boundaryField
gas_to_solid
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
value $internalField;
Tnbr T;
kappaMethod fluidThermo;
......
......@@ -34,7 +34,7 @@ boundaryField
solid_to_gas
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
value $internalField;
Tnbr T;
kappaMethod solidThermo;
......
......@@ -62,7 +62,7 @@ T
"bottomAir_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod fluidThermo;
value uniform 300;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment