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

ENH: rigidBodyMotion: new Function1-type accelerationRelaxation

See merge request Development/openfoam!520
This commit is contained in:
Andrew Heather 2021-12-15 10:17:11 +00:00
commit 0e7920efc3
356 changed files with 127 additions and 97 deletions

View File

@ -40,7 +40,7 @@ heatTransfer
{
T
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
value ${:VALUE.T};
Tnbr T;
kappaMethod fluidThermo;

View File

@ -57,7 +57,7 @@ heatTransfer
{
T
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
value ${:VALUE.T};
Tnbr T;
kappaMethod fluidThermo;

View File

@ -36,7 +36,7 @@ heatTransfer
{
T
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
value ${:VALUE.T};
Tnbr T;
kappaMethod solidThermo;

View File

@ -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);
}

View File

@ -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_;

View File

@ -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_);
}

View File

@ -262,10 +262,6 @@ addLayersControls
// Per final patch (so not geometry!) the layer information
layers
{
"blade."
{
nSurfaceLayers 2;
}
}
// Expansion factor for layer mesh

View File

@ -66,7 +66,7 @@ T
"bottomWater_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod fluidThermo;
value uniform 300;

View File

@ -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);

View File

@ -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);

View File

@ -39,7 +39,7 @@ T
}
"rightSolid_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod solidThermo;
value uniform 300;

View File

@ -72,7 +72,7 @@ T
"topAir_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod fluidThermo;
value uniform 300;

View File

@ -66,7 +66,7 @@ T
"bottomWater_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod fluidThermo;
value uniform 300;

View File

@ -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);

View File

@ -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);

View File

@ -39,7 +39,7 @@ T
}
"rightSolid_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod solidThermo;
value uniform 300;

View File

@ -72,7 +72,7 @@ T
"topAir_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod fluidThermo;
value uniform 300;

View File

@ -37,7 +37,7 @@ boundaryField
gas_to_solid
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
value $internalField;
Tnbr T;
kappaMethod fluidThermo;

View File

@ -34,7 +34,7 @@ boundaryField
solid_to_gas
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
value $internalField;
Tnbr T;
kappaMethod solidThermo;

View File

@ -62,7 +62,7 @@ T
"bottomAir_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod fluidThermo;
value uniform 300;

View File

@ -47,7 +47,7 @@ T
}
"heater_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod solidThermo;
value uniform 300;

View File

@ -43,7 +43,7 @@ T
}
"leftSolid_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod solidThermo;
value uniform 300;

View File

@ -43,7 +43,7 @@ T
}
"rightSolid_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod solidThermo;
value uniform 300;

View File

@ -72,7 +72,7 @@ T
"topAir_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod fluidThermo;
value uniform 300;

View File

@ -50,7 +50,7 @@ boundaryField
cabin_to_ice
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
value uniform 260;
Tnbr T;
kappaMethod fluidThermo;

View File

@ -34,7 +34,7 @@ boundaryField
exterior_to_ice
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
value uniform 260;
Tnbr T;
kappaMethod fluidThermo;

View File

@ -32,7 +32,7 @@ boundaryField
ice_to_cabin
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
value uniform 260;
Tnbr T;
kappaMethod fluidThermo;
@ -41,7 +41,7 @@ boundaryField
ice_to_exterior
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
value uniform 260;
Tnbr T;
kappaMethod fluidThermo;

View File

@ -66,7 +66,7 @@ T
"bottomWater_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod fluidThermo;
value uniform 300;

View File

@ -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);

View File

@ -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);

View File

@ -39,7 +39,7 @@ T
}
"rightSolid_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod solidThermo;
value uniform 300;

View File

@ -72,7 +72,7 @@ T
"topAir_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod fluidThermo;
value uniform 300;

View File

@ -64,7 +64,7 @@ T
"heater_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod solidThermo;
value uniform 300;

View File

@ -60,7 +60,7 @@ T
"leftSolid_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod solidThermo;
value uniform 300;

View File

@ -60,7 +60,7 @@ T
"rightSolid_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappaMethod solidThermo;
value uniform 300;

View File

@ -60,6 +60,7 @@ boundaryField
laminarCoeffs
{
shearStress simple;
friction ManningStrickler; // Wall friction model
n 0.005; // Manning number
Cf 0; // Gas friction

View File

@ -24,7 +24,7 @@ boundaryField
bottom
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
value $internalField;
Tnbr T;
kappaMethod fluidThermo;

View File

@ -24,7 +24,7 @@ boundaryField
top
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
type compressible::turbulentTemperatureRadCoupledMixed;
value $internalField;
Tnbr T;
kappaMethod solidThermo;

View File

@ -29,7 +29,13 @@ rigidBodyMotionCoeffs
type Newmark;
}
accelerationRelaxation 0.7;
accelerationRelaxation table
(
// time relaxation-factor
(0 0)
(3.99999 0)
(4 0.7)
);
bodies
{

View File

@ -36,7 +36,7 @@ writeFormat ascii;
writePrecision 6;
writeCompression uncompressed;
writeCompression off;
timeFormat general;

View File

@ -343,7 +343,7 @@ plot_yPlus_vs_uPlus_all_setups() {
# few manipulations
endTime=$(foamDictionary results/$setup/system/controlDict -entry endTime -value)
nu=$(foamDictionary results/$setup/constant/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g')
tau=$(foamDictionary results/$setup/$endTime/wallShearStress1:wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
tau=$(foamDictionary results/$setup/$endTime/wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
uTau=$(awk -v tau="$tau" 'BEGIN { printf "%.16f", sqrt(-1*tau) }')
sampleFiles[$n]="results/$setup/postProcessing/sample/$endTime/y_U.xy"
@ -398,7 +398,7 @@ plot_yPlus_vs_R_all_setups() {
# few manipulations
endTime=$(foamDictionary results/$setup/system/controlDict -entry endTime -value)
nu=$(foamDictionary results/$setup/constant/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g')
tau=$(foamDictionary results/$setup/$endTime/wallShearStress1:wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
tau=$(foamDictionary results/$setup/$endTime/wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
uTau=$(awk -v tau="$tau" 'BEGIN { printf "%.16f", sqrt(-1*tau) }')
sampleFiles[$n]="results/$setup/postProcessing/sample/$endTime/y_turbulenceProperties:R.xy"
@ -500,7 +500,7 @@ plot_yPlus_vs_epsilonPlus_all_setups() {
# few manipulations
endTime=$(foamDictionary results/$setup/system/controlDict -entry endTime -value)
nu=$(foamDictionary results/$setup/constant/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g')
tau=$(foamDictionary results/$setup/$endTime/wallShearStress1:wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
tau=$(foamDictionary results/$setup/$endTime/wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
uTau=$(awk -v tau="$tau" 'BEGIN { printf "%.16f", sqrt(-1*tau) }')
sampleFiles[$n]="results/$setup/postProcessing/sampleEpsilon/$endTime/y_turbulenceProperties:epsilon.xy"
@ -555,7 +555,7 @@ plot_yPlus_vs_productionRatePlus_all_setups() {
# few manipulations
endTime=$(foamDictionary results/$setup/system/controlDict -entry endTime -value)
nu=$(foamDictionary results/$setup/constant/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g')
tau=$(foamDictionary results/$setup/$endTime/wallShearStress1:wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
tau=$(foamDictionary results/$setup/$endTime/wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
uTau=$(awk -v tau="$tau" 'BEGIN { printf "%.16f", sqrt(-1*tau) }')
sampleFiles[$n]="results/$setup/postProcessing/sampleG/$endTime/y_productionRate.xy"
@ -634,7 +634,7 @@ do
# few manipulations
endTime=$(foamDictionary results/$setup/system/controlDict -entry endTime -value)
nu=$(foamDictionary results/$setup/constant/transportProperties -entry nu | sed 's|^.*\s\(.*\);|\1|g')
tau=$(foamDictionary results/$setup/$endTime/wallShearStress1:wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
tau=$(foamDictionary results/$setup/$endTime/wallShearStress -entry boundaryField.bottom.value -value | sed -n '/(/,/)/p' | sed -e 's/[()]//g;/^\s*$/d' | cut -d' ' -f6)
uTau=$(awk -v tau="$tau" 'BEGIN { printf "%.16f", sqrt(-1*tau) }')
plot_yPlus_vs_uPlus "$setup" "$endTime" "$nu" "$uTau"

Some files were not shown because too many files have changed in this diff Show More