4 #include "../Constants/Constants.h"
5 #include "../InfoStruct/InfoStruct.h"
6 #include "../Math/Functions.h"
7 #include "../Particle/Particle.h"
8 #include "../Units/Units.h"
9 #include "../Vector/Vector.hpp"
10 #include "PressureGauge.h"
12 #include "rapidjson/document.h"
13 #include "rapidjson/prettywriter.h"
15 #include <boost/numeric/odeint.hpp>
16 #include <boost/numeric/ublas/vector.hpp>
20 namespace MDSimulation
24 namespace odeint = boost::numeric::odeint;
26 typedef boost::numeric::ublas::vector<double> state_type;
27 typedef boost::numeric::ublas::matrix<double> matrix_type;
28 typedef odeint::runge_kutta_fehlberg78<state_type> error_stepper_type;
29 typedef odeint::controlled_runge_kutta<error_stepper_type> controlled_stepper_type;
45 const double& CurrentTime;
50 state_type PrevRadius;
51 state_type NextRadius;
53 std::vector<double> Times;
54 std::vector<double> Radii;
55 std::vector<double> Velocities;
57 controlled_stepper_type ControlledSolver;
66 double SurfaceTension;
77 double ComputedPressure;
93 void Init(
const std::string& outDir =
"");
108 RPK(
const double& currentTime,
const InfoStruct& info,
const std::string& outDir =
"");
123 void AddSample(
const double time,
const double pressure);
129 double R(
const double time)
const;
135 double V(
const double time)
const;
143 double VSmart(
const double time)
const;
177 template <
typename Writer>
190 state_type
operator()(
const state_type& x, state_type& dxdt,
const double t)
const;
203 template <
typename Writer>
207 writer.String(
"kR") , writer.Double(kR);
208 writer.String(
"Time") , writer.Double(Time);
209 writer.String(
"Time") , writer.Double(Time);
210 writer.String(
"TimeStep") , writer.Double(TimeStep);
211 writer.String(
"A") , writer.Double(A);
212 writer.String(
"B") , writer.Double(B);
213 writer.String(
"R03") , writer.Double(R03);
214 writer.String(
"a3") , writer.Double(a3);
215 writer.String(
"P0") , writer.Double(P0);
216 writer.String(
"Density") , writer.Double(Density);
217 writer.String(
"Viscosity") , writer.Double(Viscosity);
218 writer.String(
"SurfaceTension") , writer.Double(SurfaceTension);
219 writer.String(
"SpeedOfSound") , writer.Double(SpeedOfSound);
220 writer.String(
"Omega") , writer.Double(Omega);
222 writer.String(
"PGauge");
void AddSample(const double time, const double pressure)
Add a sample to the pressure gauge.
Definition: RPK.cpp:77
~RPK()
Clean up the dynamically allocated memory for the solver methods.
Definition: RPK.cpp:72
void Serialize(Writer &writer) const
New serialization method that makes use of the ptree library.
Definition: RPK.h:204
PressureGauge.h - pressure gauge class declaration Written by Alexander Bass, modified by Max I...
Definition: PressureGauge.h:19
double NextStepTime()
Definition: RPK.cpp:110
This module defines the RPK class.
Definition: RPK.h:41
double FindCrossingTime(const Particle &n) const
Definition: RPK.cpp:337
double AcousticPressureDerivative(const double time) const
Compute the derivative of the acoustic pressure at the given time.
Definition: RPK.cpp:324
state_type operator()(const state_type &x, state_type &dxdt, const double t) const
Deserialization method that can read in the data produced by the serialize method.
Definition: RPK.cpp:209
double AcousticPressure(const double time) const
Compute the acoustic pressure at the given time.
Definition: RPK.cpp:311
double R(const double time) const
Definition: RPK.cpp:85
void ReadPressureGauge()
Reads the pressure gauge to update the current pressure and dpdt value.
double VSmart(const double time) const
Smarter version of the velocity calculation that uses the computed velocities for each end of the cur...
Definition: RPK.cpp:97
double V(const double time) const
Definition: RPK.cpp:92
double d2Rdt2() const
Definition: RPK.cpp:103
void Serialize(FILE *file, bool save=true)
Serialize the pressure gauge to disk.
Defines the structure used to hold the configurable constants of the simulation.
Definition: InfoStruct.h:36
Definition of a basic particle type.
Definition: Particle.h:23
RPK(const double ¤tTime, const InfoStruct &info, const std::string &outDir="")
Create a new RPK equation using the given InfoStruct for the various constants needed.
Definition: RPK.cpp:60
double NextStep()
Definition: RPK.cpp:116