Keep central density as seed data in the n1 sandbox
This commit is contained in:
10
sandbox.cpp
10
sandbox.cpp
@@ -99,9 +99,8 @@ int main(
|
||||
// const double polytropicConstant = 0.3639391; // Use for n=3 test
|
||||
|
||||
std::println("K = {}", polytropicConstant);
|
||||
const double centralDensity =
|
||||
const double seedCentralDensity =
|
||||
std::numbers::pi_v<double> * mass / (4.0 * radius * radius * radius);
|
||||
//const double centralDensity =12.9351146; // use for n=3 test
|
||||
|
||||
auto stellarModel = model::StellarModel(
|
||||
eos::Polytrope({.n = 1.0, .K = polytropicConstant}),
|
||||
@@ -111,8 +110,7 @@ int main(
|
||||
.Jtotal = dimensions::AngularMomentumValue{angularMomentum},
|
||||
.axis = {0.0, 0.0, 1.0},
|
||||
.center = {0.0, 0.0, 0.0}
|
||||
}),
|
||||
constraint::FixedCentralDensity({.RhoC = dimensions::DensityValue{centralDensity}})
|
||||
})
|
||||
);
|
||||
|
||||
auto discretization = equilibrium::makeStellarDiscretization(
|
||||
@@ -126,8 +124,10 @@ int main(
|
||||
auto preconditioner = preconditioning::makePreconditioner();
|
||||
auto linearSolver = solver::linear::FGMRES({.restartLength = 40, .printLevel = 1});
|
||||
const auto contextStart = std::chrono::steady_clock::now();
|
||||
// This density initializes the seed; the n=1 equilibrium is free to change it.
|
||||
auto context = solver::makeContext(
|
||||
std::move(stellarModel), std::move(discretization), std::move(preconditioner), std::move(linearSolver)
|
||||
std::move(stellarModel), std::move(discretization), std::move(preconditioner), std::move(linearSolver),
|
||||
seed::LaneEmden({.centralDensity = dimensions::DensityValue{seedCentralDensity}})
|
||||
);
|
||||
if (rank == 0) {
|
||||
std::cout << "Solver context setup: "
|
||||
|
||||
Reference in New Issue
Block a user