46 , omega0{ sqrt(k / mass) }
48 , frequency0(1 / period0)
50 , gamma{ 0.5 * beta / mass }
59 inline double expfactor(
double t)
const {
return exp(-gamma * t); }
68 return -2 * gamma * v - pow(omega0, 2) * x;
84 double gamma2 = pow(gm, 2);
85 double omega02 = pow(omg0, 2);
88 if (gamma2 > omega02) {
90 }
else if (std::abs(gamma2 - omega02) < 1e-6) {
118 :
X1500{ mass, k, beta, initc } {
120 _omega = sqrt(pow(gamma, 2) - pow(omega0, 2));
128 inline double x(
double t)
const {
129 const double phs = omega() * t;
130 const double fac = (x0 / omega());
131 const double trm0 = (omega() * cosh(phs) + gamma * sinh(phs));
132 const double term = fac * trm0;
133 return expfactor(t) * term;
141 inline double v(
double t)
const {
142 const double phase = omega() * t;
143 const double trm0 = (x0 / omega()) * sinh(phase);
144 return -pow(omega0, 2) * expfactor(t) * trm0;
151 inline double omega()
const {
return _omega; }
168 :
X1500{ mass, k, beta, initc } {
177 inline double x(
double t)
const {
178 return x0 * expfactor(t) * (1 + gamma * t);
186 inline double v(
double t)
const {
187 return -x0 * t * expfactor(t) * pow(gamma, 2);
197 double _phi0, _C, _omega;
208 :
X1500{ mass, k, beta, initc } {
210 _omega = sqrt(pow(omega0, 2) - pow(gamma, 2));
211 _phi0 = atan2(omega(), gamma);
212 _C = omega0 * x0 / _omega;
219 inline double x(
double t)
const {
220 return _C * expfactor(t) * sin(omega() * t + _phi0);
228 inline double v(
double t)
const {
229 const double phase = omega() * t + _phi0;
230 const double part1 = -gamma * x(t);
231 const double part2 = _C * expfactor(t) * omega() * cos(phase);
232 return part1 + part2;
239 inline double omega()
const {
return _omega; }
266 inline int odefn(
double t,
const double fin[],
double fout[]) {
269 fout[1] = acceleration(fin[0], fin[1]);
277 Ode ode{ *
this, 1e-2, 1e-9, 0 };
279 double t = 0, tmax = 2 * period0, dt = tmax / 100;
281 _data += { t, ode[0], ode[1] };
294 for (
auto &crow : _data.data()) {
296 const double epot = 0.5 * k * pow(crow[1], 2);
297 crow[3] = ekin + epot;
300 auto exactFn = [
this](
auto cobj) {
301 for (
auto &crow : _data.data()) {
302 const double t = crow[0];
309 exactFn(
Overdamped(mass, k, beta, { x0, v0 }));
313 exactFn(
Critical(mass, k, beta, { x0, v0 }));
322 save(_data.select_total_rows(6),
324 static_cast<int>(type()));
333 const double mass = 1.0;
334 const double x0 = 30.0_mm;
335 const double v0 = 0.0;
340 C1500 cobj0{ mass, k, beta, { x0, v0 } };
347 C1500 cobj1{ mass, k, beta, { x0, v0 } };
354 C1500 cobj2{ mass, k, beta, { x0, v0 } };
Underdamped(double mass, double k, double beta, IValues initc)
Underdamped Konstruktor.
double acceleration(double x, double v) const
acceleration
static double kinetic_energy(double mass, double velocity)
kinetic_energy Hilfsfunktion
Damping
The Damping enum Mögliche Schwingungstypen.
void set_init_conditions(double t, const Array &y)
set_init_conditions lege Anfangsbedingungen fest
Damping type() const
type Berechnung des Dämpfungstyps
The X1500 class Harmonische Schwingungen mit Dämpfung (Modellklasse)
X1500(double mass, double k, double beta, IValues initc)
X1500 Konstruktor.
double x(double t) const
x Ort als Funktion der Zeit
The Odeiv2 class numerische Lösung eines Systems von N Differenzialgleichungen Schnittstelle zur gsl...
static Damping type(double gm, double omg0)
type Hilfsfunktion zur Ermittlung des Dämpfungstyps
The XModel class Basisklasse speichert eine ID in Form einer Zeichenkette enthält Hilfsfunktionen zur...
std::array< double, 2 > IValues
static void error_if_not(const std::string &s, bool arg)
error_if_not Fehler wenn Bedingung nicht erfüllt ist
double v(double t) const
v Geschwindigkeit als Funktion der Zeit
double x(double t) const
x Ort als Funktion der Zeit
int odefn(double t, const double fin[], double fout[])
odefn Transformation in ein System von linearen Dgl
double expfactor(double t) const
expfactor Hilfsfunktion
double x(double t) const
x Ort als Funktion der Zeit
double omega() const
omega Kreisfrequenz
void exec()
exec numerische Berechnung der Daten
void solve_ode()
solve_ode numerische Lösung der Bewegungsgleichung
Overdamped(double mass, double k, double beta, IValues initc)
Overdamped Konstruktor.
double v(double t) const
v Geschwindigkeit als Funktion der Zeit
void run()
run Berechnung von Beispieldaten
The Critical class Aperiodischer Grenzfall (Rechenmodell)
double v(double t) const
v Geschwindigkeit als Funktion der Zeit
The Underdamped class Schwache Dämpfung (Rechenmodell)
double fac(size_t n)
fac Berechnung von n! exakt oder mit einer Näherungsformel
The X1500 class Harmonische Schwingungen mit Dämpfung.
void save_data()
save_data Ausgabe der Daten im Tabellen und Grafikformat
static constexpr double PI
static const Format latex
The Overdamped class starke Dämpfung (Rechenmodell)
double omega() const
omega
Critical(double mass, double k, double beta, IValues initc)
Critical Konstruktor.