45#include "hydrodynamics/Ellipsoid.hpp"
48#include "utils/Constants.hpp"
52 Ellipsoid::Ellipsoid(Vector3d origin, RealType rAxial, RealType rEquatorial,
55 rAxial_(rAxial), rEquatorial_(rEquatorial), rotMat_(rotMat) {
56 if (rAxial_ > rEquatorial_) {
58 rMinor_ = rEquatorial_;
60 rMajor_ = rEquatorial_;
65 bool Ellipsoid::isInterior(Vector3d pos) {
66 Vector3d r = pos - origin_;
67 Vector3d rbody = rotMat_ * r;
69 RealType xoverb = rbody[0] / rEquatorial_;
70 RealType yoverb = rbody[1] / rEquatorial_;
71 RealType zovera = rbody[2] / rAxial_;
74 if (xoverb * xoverb + yoverb * yoverb + zovera * zovera < 1)
82 std::pair<Vector3d, Vector3d> Ellipsoid::getBoundingBox() {
83 std::pair<Vector3d, Vector3d> boundary;
85 RealType rad = rAxial_ > rEquatorial_ ? rAxial_ : rEquatorial_;
86 Vector3d r(rad, rad, rad);
87 boundary.first = origin_ - r;
88 boundary.second = origin_ + r;
92 HydroProp* Ellipsoid::getHydroProp(RealType viscosity) {
94 RealType b = rEquatorial_;
102 S = 2.0 / sqrt(a2 - b2) * log((a + sqrt(a2 - b2)) / b);
105 S = 2.0 / sqrt(b2 - a2) * atan(sqrt(b2 - a2) / a);
108 RealType pi = Constants::PI;
110 16.0 * pi * viscosity * (a2 - b2) / ((2.0 * a2 - b2) * S - 2.0 * a);
111 RealType XittB = 32.0 * pi * viscosity * (a2 - b2) /
112 ((2.0 * a2 - 3.0 * b2) * S + 2.0 * a);
114 32.0 / 3.0 * pi * viscosity * (a2 - b2) * b2 / (2.0 * a - b2 * S);
115 RealType XirrB = 32.0 / 3.0 * pi * viscosity * (a2 * a2 - b2 * b2) /
116 ((2.0 * a2 - b2) * S - 2.0 * a);
127 Xi *= Constants::viscoConvert;
129 HydroProp* hprop =
new HydroProp(V3Zero, Xi);
130 hprop->setName(getName());
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.