Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "SDA.H"
00027 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00028 #include <OpenFOAM/mathematicalConstants.H>
00029
00030 using namespace Foam::mathematicalConstant;
00031
00032
00033
00034 namespace Foam
00035 {
00036 namespace solidBodyMotionFunctions
00037 {
00038 defineTypeNameAndDebug(SDA, 0);
00039 addToRunTimeSelectionTable(solidBodyMotionFunction, SDA, dictionary);
00040 };
00041 };
00042
00043
00044
00045
00046 Foam::solidBodyMotionFunctions::SDA::SDA
00047 (
00048 const dictionary& SBMFCoeffs,
00049 const Time& runTime
00050 )
00051 :
00052 solidBodyMotionFunction(SBMFCoeffs, runTime),
00053 CofG_(SBMFCoeffs_.lookup("CofG"))
00054 {
00055 read(SBMFCoeffs);
00056 }
00057
00058
00059
00060
00061 Foam::solidBodyMotionFunctions::SDA::~SDA()
00062 {}
00063
00064
00065
00066
00067 Foam::septernion Foam::solidBodyMotionFunctions::SDA::transformation() const
00068 {
00069 scalar time = time_.value();
00070
00071 scalar Tpi = Tp_ + dTp_*(time/dTi_);
00072 scalar wr = 2*pi/Tpi;
00073
00074
00075 scalar r = dTp_/dTi_;
00076 scalar u = Tp_ + r*time;
00077 scalar phr = 2*pi*((Tp_/u - 1) + log(mag(u)) - log(Tp_))/r;
00078
00079
00080 scalar phs = phr + pi;
00081
00082
00083 scalar phh = phr + pi/2;
00084
00085 scalar rollA = max(rollAmax_*exp(-sqr(Tpi - Tpn_)/(2*Q_)), rollAmin_);
00086
00087 vector T
00088 (
00089 0,
00090 swayA_*(sin(wr*time + phs) - sin(phs)),
00091 heaveA_*(sin(wr*time + phh) - sin(phh))
00092 );
00093 quaternion R(rollA*sin(wr*time + phr), 0, 0);
00094 septernion TR(septernion(CofG_ + T)*R*septernion(-CofG_));
00095
00096 Info<< "solidBodyMotionFunctions::SDA::transformation(): "
00097 << "Time = " << time << " transformation: " << TR << endl;
00098
00099 return TR;
00100 }
00101
00102
00103 bool Foam::solidBodyMotionFunctions::SDA::read(const dictionary& SBMFCoeffs)
00104 {
00105 solidBodyMotionFunction::read(SBMFCoeffs);
00106
00107 SBMFCoeffs_.lookup("CofG") >> CofG_;
00108 SBMFCoeffs_.lookup("lamda") >> lamda_;
00109 SBMFCoeffs_.lookup("rollAmax") >> rollAmax_;
00110 SBMFCoeffs_.lookup("rollAmin") >> rollAmin_;
00111 SBMFCoeffs_.lookup("heaveA") >> heaveA_;
00112 SBMFCoeffs_.lookup("swayA") >> swayA_;
00113 SBMFCoeffs_.lookup("Q") >> Q_;
00114 SBMFCoeffs_.lookup("Tp") >> Tp_;
00115 SBMFCoeffs_.lookup("Tpn") >> Tpn_;
00116 SBMFCoeffs_.lookup("dTi") >> dTi_;
00117 SBMFCoeffs_.lookup("dTp") >> dTp_;
00118
00119
00120 if (lamda_ > 1 + SMALL)
00121 {
00122 heaveA_ /= lamda_;
00123 swayA_ /= lamda_;
00124 Tp_ /= sqrt(lamda_);
00125 Tpn_ /= sqrt(lamda_);
00126 dTi_ /= sqrt(lamda_);
00127 dTp_ /= sqrt(lamda_);
00128 }
00129
00130 return true;
00131 }
00132
00133
00134