diff --git a/doc/examples/example-oscil-torus.xml b/doc/examples/example-oscil-torus.xml index f02dda5b..25b5e512 100644 --- a/doc/examples/example-oscil-torus.xml +++ b/doc/examples/example-oscil-torus.xml @@ -40,8 +40,8 @@ t2 area2 ... tN areaN - BreathingPlus - Perturbation kind, one of Radial Vertical X BreathingMinus BreathingPlus + Breathing + Perturbation kind, one of Radial Vertical X Plus Breathing 0.15 Perturbation strength diff --git a/include/GyotoOscilTorus.h b/include/GyotoOscilTorus.h index 1ba488bb..7b199ac6 100644 --- a/include/GyotoOscilTorus.h +++ b/include/GyotoOscilTorus.h @@ -48,7 +48,7 @@ class Gyoto::Astrobj::OscilTorus double polycst_; ///< Polytropic constant double polyindex_; ///< Polytropic index double central_density_; ///< Central density - enum perturb_t {Radial=1, Vertical=2, X=3, BreathingMinus=4, BreathingPlus=5}; + enum perturb_t {Radial=1, Vertical=2, X=3, Plus=4, Breathing=5}; perturb_t perturb_kind_; std::string emitting_area_; ///< Only for mode=0, file containing time series of cross section area double perturb_intens_; ///< Perturbation intensity diff --git a/lib/OscilTorus.C b/lib/OscilTorus.C index b74e7867..80d51442 100644 --- a/lib/OscilTorus.C +++ b/lib/OscilTorus.C @@ -30,7 +30,7 @@ GYOTO_PROPERTY_DOUBLE(OscilTorus,PolyIndex, polyIndex, GYOTO_PROPERTY_DOUBLE(OscilTorus,CentralDensity, centralDensity, "Central density.") GYOTO_PROPERTY_STRING(OscilTorus,PerturbKind, perturbKind, - "One of: Radial Vertical X BreathingMinus BreathingPlus") + "One of: Radial Vertical X Plus Breathing") GYOTO_PROPERTY_DOUBLE(OscilTorus, PerturbIntens, perturbIntens, "Perturbations intensity.") GYOTO_PROPERTY_FILENAME(OscilTorus, EmittingArea, emittingArea, @@ -47,11 +47,11 @@ GYOTO_PROPERTY_ACCESSORS(OscilTorus, double, central_density_, centralDensity) GYOTO_PROPERTY_ACCESSORS(OscilTorus, double, perturb_intens_, perturbIntens) void OscilTorus::perturbKind(std::string const &k) { - if (k == "Radial") perturb_kind_ = Radial; - else if (k == "Vertical") perturb_kind_ = Vertical; - else if (k == "X") perturb_kind_ = X; - else if (k == "BreathingMinus") perturb_kind_ = BreathingMinus; - else if (k == "BreathingPlus") perturb_kind_ = BreathingPlus; + if (k == "Radial") perturb_kind_ = Radial; + else if (k == "Vertical") perturb_kind_ = Vertical; + else if (k == "X") perturb_kind_ = X; + else if (k == "Plus") perturb_kind_ = Plus; + else if (k == "Breathing") perturb_kind_ = Breathing; else { string errmsg="unknown perturbation kind: '"; errmsg += k + "'"; @@ -61,11 +61,11 @@ void OscilTorus::perturbKind(std::string const &k) { } std::string OscilTorus::perturbKind() const { switch (perturb_kind_) { - case Radial: return "Radial"; - case Vertical: return "Vertical"; - case X: return "X"; - case BreathingMinus: return "BreathingMinus"; - case BreathingPlus: return "BreathingPlus"; + case Radial: return "Radial"; + case Vertical: return "Vertical"; + case X: return "X"; + case Plus: return "Plus"; + case Breathing: return "Breathing"; } } @@ -178,31 +178,19 @@ double OscilTorus::operator()(double const pos[4]) { // cout << "xb,yb= " << x_bar << " " << y_bar << endl; double uu=0.; // perturbation-dependent factor of surface function switch (perturb_kind_) { - case Radial: // Radial oscillation - { - uu = x_bar; - break; - } - case Vertical: // Vertical oscillation - { - uu = y_bar; - break; - } - case X: // X mode - { - uu = x_bar*y_bar; - break; - } - case BreathingMinus: // breathing - mode - { - uu = 1+w1_*x_bar*x_bar+w2_*y_bar*y_bar; - break; - } - case BreathingPlus: // breathing + mode - { - uu = 1+w1_*x_bar*x_bar+w2_*y_bar*y_bar; - break; - } + case Radial: + uu = x_bar; + break; + case Vertical: + uu = y_bar; + break; + case X: + uu = x_bar*y_bar; + break; + case Plus: + case Breathing: + uu = 1+w1_*x_bar*x_bar+w2_*y_bar*y_bar; + break; default: throwError("In OscilTorus.C::operator():" "Unrecognized perturbation kind"); @@ -239,34 +227,21 @@ void OscilTorus::getVelocity(double const pos[4], double vel[4]) double vr=0., vth=0.; switch (perturb_kind_) { - case Radial: // Radial oscil - { - vr = 1.; + case Radial: + vr = 1.; break; - } - case Vertical: // Vertical oscil - { - vth = 1.; + case Vertical: + vth = 1.; + break; + case X: + vr = y_bar; + vth = x_bar; + break; + case Plus: + case Breathing: + vr = 2.*w1_*x_bar; + vth = 2.*w2_*y_bar; break; - } - case X: // X mode - { - vr = y_bar; - vth = x_bar; - break; - } - case BreathingMinus: // breathing - mode - { - vr = 2.*w1_*x_bar; - vth = 2.*w2_*y_bar; - break; - } - case BreathingPlus: // breathing + mode - { - vr = 2.*w1_*x_bar; - vth = 2.*w2_*y_bar; - break; - } default: throwError("In OscilTorus.C::operator():" "Unrecognized perturbation kind"); @@ -403,7 +378,7 @@ void OscilTorus::updateCachedValues() { alpha_ = alpha0*sqrt(4*(polyindex_+1)*(polyindex_+2)*omr2_*omth2_); break; } - case BreathingMinus: // breathing - mode + case Plus: // + mode { double sigmaminus2 = ( (2.*polyindex_+1)*(omr2_+omth2_) @@ -428,7 +403,7 @@ void OscilTorus::updateCachedValues() { ); break; } - case BreathingPlus: // breathing + mode + case Breathing: // breathing mode { double sigmaplus2 = ( (2.*polyindex_+1)*(omr2_+omth2_)