feat(topology): vacuum coordinate and multi block

Two major changes in this version. First stroid now embeds a vacuum coordinate as part of its StroidMesh file (this is a packed set of mfem meshes and GridFunction). This is a logical coordinate from 0 at the stellar surface to 1 at the mesh surface / compactified infinity which can be used by consumers to much more stablly infer position in the vacuum region. Second, there is a new topology backend, multi_block, which has been made the default. See the readme for more information but the basic jist is that multi_block addes 6 transition blocks onto the edge of the core domain. This allows for a much more well conditioned transition from the internal cartesien region to the external spherical region. The mesh conditioning improves by roughly a factor of 1000 for the same refinement level when compared to the legacy topology. The legacy topology is maintained as a option if core_mapping is set to spherified in the config.
This commit is contained in:
2026-09-09 08:11:08 -04:00
parent db727ebd7b
commit a5905e5fed
27 changed files with 1693 additions and 183 deletions

View File

@@ -52,7 +52,8 @@ void register_config_bindings(pybind11::module_& m) {
.core_id = kwargs.contains("core_id") ? kwargs["core_id"].cast<size_t>() : core_id,
.envelope_id = kwargs.contains("envelope_id") ? kwargs["envelope_id"].cast<size_t>() : envelope_id,
.vacuum_id = kwargs.contains("vacuum_id") ? kwargs["vacuum_id"].cast<size_t>() : vacuum_id,
.optimization_methods = kwargs.contains("optimization_methods") ? kwargs["optimization_methods"].cast<stroid::config::OptimizationMethods>() : opt_method
.optimization_methods = kwargs.contains("optimization_methods") ? kwargs["optimization_methods"].cast<stroid::config::OptimizationMethods>() : opt_method,
.core_mapping = kwargs.contains("core_mapping") ? kwargs["core_mapping"].cast<std::string>() : "spherified"
};
}))
.def_property(
@@ -198,5 +199,20 @@ void register_config_bindings(pybind11::module_& m) {
[](stroid::config::MeshConfig& self, stroid::config::OptimizationMethods value) {
self.optimization_methods = value;
}
);
}
)
.def_property(
"core_mapping",
[](const stroid::config::MeshConfig& self) {
return self.core_mapping;
},
[](stroid::config::MeshConfig& self, const std::string& value) {
if (value != "spherified" && value != "multi_block") {
throw std::invalid_argument("Invalid core_mapping value. Must be 'spherified' or 'multi_block'.");
}
self.core_mapping = value;
}
)
.def("__repr__", [](const stroid::config::MeshConfig& self) {
return stroid::config::to_string(self);
});
}