feat(newton): first newton solver implementation
This commit is contained in:
@@ -182,12 +182,11 @@ namespace mean_field::seed::detail {
|
||||
|
||||
double radialMomentIntegral = 0.0;
|
||||
for (int index = 0; index + 1 < profile.radius.Size(); ++index) {
|
||||
const double leftRadius = profile.radius(index);
|
||||
const double rightRadius = profile.radius(index + 1);
|
||||
const double leftIntegrand = profile.density(index) * std::pow(leftRadius, 4);
|
||||
const double leftRadius = profile.radius(index);
|
||||
const double rightRadius = profile.radius(index + 1);
|
||||
const double leftIntegrand = profile.density(index) * std::pow(leftRadius, 4);
|
||||
const double rightIntegrand = profile.density(index + 1) * std::pow(rightRadius, 4);
|
||||
radialMomentIntegral +=
|
||||
0.5 * (rightRadius - leftRadius) * (leftIntegrand + rightIntegrand);
|
||||
radialMomentIntegral += 0.5 * (rightRadius - leftRadius) * (leftIntegrand + rightIntegrand);
|
||||
}
|
||||
const double sphericalMomentOfInertia = (8.0 * std::numbers::pi / 3.0) * radialMomentIntegral;
|
||||
if (!std::isfinite(sphericalMomentOfInertia) || sphericalMomentOfInertia <= 0.0) {
|
||||
@@ -208,11 +207,11 @@ namespace mean_field::seed::detail {
|
||||
);
|
||||
|
||||
return {
|
||||
.density = densityAdapter.gather(densityField),
|
||||
.gravityGradient = gravityFluxAdapter.gather(gravitySolution.gradPhi),
|
||||
.gravityPotential = gravityPotentialAdapter.gather(gravitySolution.phi),
|
||||
.specificEnthalpy = enthalpyAdapter.gather(enthalpyField),
|
||||
.bernoulliConstant = -utils::G * targetMass.value() / targetRadius,
|
||||
.density = densityAdapter.gather(densityField),
|
||||
.gravityGradient = gravityFluxAdapter.gather(gravitySolution.gradPhi),
|
||||
.gravityPotential = gravityPotentialAdapter.gather(gravitySolution.phi),
|
||||
.specificEnthalpy = enthalpyAdapter.gather(enthalpyField),
|
||||
.bernoulliConstant = -utils::G * targetMass.value() / targetRadius,
|
||||
.sphericalMomentOfInertia = sphericalMomentOfInertia
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user