-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add BNS initial data executable and SpEC initial Data #6422
Open
isaaclegred
wants to merge
3
commits into
sxs-collaboration:develop
Choose a base branch
from
isaaclegred:BNS_InitialDataExecutable
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Distributed under the MIT License. | ||
# See LICENSE.txt for details. | ||
|
||
set(EXECUTABLE "SolveBnsInitialData") | ||
|
||
add_spectre_executable( | ||
${EXECUTABLE} | ||
EXCLUDE_FROM_ALL | ||
SolveBnsInitialData.cpp | ||
) | ||
|
||
set(LIBS_TO_LINK | ||
Charmxx::main | ||
Convergence | ||
CoordinateMaps | ||
DiscontinuousGalerkin | ||
DomainCreators | ||
Elliptic | ||
EllipticDg | ||
EllipticDgSubdomainOperator | ||
EllipticSubdomainPreconditioners | ||
Events | ||
EventsAndTriggers | ||
Informer | ||
BnsInitialData | ||
BnsInitialDataAnalyticData | ||
BnsInitialDataBoundaryConditions | ||
LinearOperators | ||
MathFunctions | ||
Observer | ||
Options | ||
Parallel | ||
ParallelLinearSolver | ||
ParallelMultigrid | ||
ParallelSchwarz | ||
PhaseControl | ||
RelativisticEulerSolutions | ||
Utilities | ||
) | ||
|
||
|
||
|
||
target_link_libraries(${EXECUTABLE} PRIVATE ${LIBS_TO_LINK}) |
29 changes: 29 additions & 0 deletions
29
src/Elliptic/Executables/BnsInitialData/SolveBnsInitialData.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Distributed under the MIT License. | ||
// See LICENSE.txt for details. | ||
|
||
#include "Elliptic/Executables/BnsInitialData/SolveBnsInitialData.hpp" | ||
|
||
#include <vector> | ||
|
||
#include "Domain/Creators/RegisterDerivedWithCharm.hpp" | ||
#include "Domain/FunctionsOfTime/RegisterDerivedWithCharm.hpp" | ||
#include "Elliptic/SubdomainPreconditioners/RegisterDerived.hpp" | ||
#include "Parallel/CharmMain.tpp" | ||
#include "PointwiseFunctions/Hydro/EquationsOfState/RegisterDerivedWithCharm.hpp" | ||
#include "Utilities/Serialization/RegisterDerivedClassesWithCharm.hpp" | ||
|
||
// Parameters chosen in CMakeLists.txt | ||
using metavariables = Metavariables; | ||
|
||
extern "C" void CkRegisterMainModule() { | ||
Parallel::charmxx::register_main_module<metavariables>(); | ||
Parallel::charmxx::register_init_node_and_proc( | ||
{&domain::creators::register_derived_with_charm, | ||
&domain::FunctionsOfTime::register_derived_with_charm, | ||
®ister_derived_classes_with_charm< | ||
metavariables::solver::schwarz_smoother::subdomain_solver>, | ||
&elliptic::subdomain_preconditioners::register_derived_with_charm, | ||
&EquationsOfState::register_derived_with_charm, | ||
®ister_factory_classes_with_charm<metavariables>}, | ||
{}); | ||
} |
185 changes: 185 additions & 0 deletions
185
src/Elliptic/Executables/BnsInitialData/SolveBnsInitialData.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
// Distributed under the MIT License. | ||
// See LICENSE.txt for details. | ||
|
||
#pragma once | ||
|
||
#include <cstddef> | ||
|
||
#include "DataStructures/DataBox/PrefixHelpers.hpp" | ||
#include "DataStructures/Tensor/IndexType.hpp" | ||
#include "Domain/Creators/Factory1D.hpp" | ||
#include "Domain/Creators/Factory2D.hpp" | ||
#include "Domain/Creators/Factory3D.hpp" | ||
#include "Domain/RadiallyCompressedCoordinates.hpp" | ||
#include "Domain/Tags.hpp" | ||
#include "Elliptic/Actions/RunEventsAndTriggers.hpp" | ||
#include "Elliptic/BoundaryConditions/BoundaryCondition.hpp" | ||
#include "Elliptic/DiscontinuousGalerkin/DgElementArray.hpp" | ||
#include "Elliptic/Executables/Solver.hpp" | ||
#include "Elliptic/Systems/BnsInitialData/BoundaryConditions/Factory.hpp" | ||
#include "Elliptic/Systems/BnsInitialData/FirstOrderSystem.hpp" | ||
#include "Elliptic/Triggers/Factory.hpp" | ||
#include "IO/Observer/Actions/RegisterEvents.hpp" | ||
#include "IO/Observer/Helpers.hpp" | ||
#include "IO/Observer/ObserverComponent.hpp" | ||
#include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp" | ||
#include "Options/Protocols/FactoryCreation.hpp" | ||
#include "Options/String.hpp" | ||
#include "Parallel/Phase.hpp" | ||
#include "Parallel/PhaseControl/ExecutePhaseChange.hpp" | ||
#include "Parallel/PhaseControl/VisitAndReturn.hpp" | ||
#include "Parallel/PhaseDependentActionList.hpp" | ||
#include "Parallel/Protocols/RegistrationMetavariables.hpp" | ||
#include "Parallel/Reduction.hpp" | ||
#include "ParallelAlgorithms/Actions/TerminatePhase.hpp" | ||
#include "ParallelAlgorithms/Amr/Actions/SendAmrDiagnostics.hpp" | ||
#include "ParallelAlgorithms/Amr/Criteria/Factory.hpp" | ||
#include "ParallelAlgorithms/Amr/Protocols/AmrMetavariables.hpp" | ||
#include "ParallelAlgorithms/Events/Factory.hpp" | ||
#include "ParallelAlgorithms/Events/Tags.hpp" | ||
#include "ParallelAlgorithms/EventsAndTriggers/Completion.hpp" | ||
#include "ParallelAlgorithms/EventsAndTriggers/Event.hpp" | ||
#include "ParallelAlgorithms/EventsAndTriggers/Trigger.hpp" | ||
#include "ParallelAlgorithms/LinearSolver/Multigrid/ElementsAllocator.hpp" | ||
#include "ParallelAlgorithms/LinearSolver/Multigrid/ObserveVolumeData.hpp" | ||
#include "ParallelAlgorithms/LinearSolver/Multigrid/Tags.hpp" | ||
#include "PointwiseFunctions/AnalyticData/BnsInitialData/Factory.hpp" | ||
#include "PointwiseFunctions/Hydro/EquationsOfState/RegisterDerivedWithCharm.hpp" | ||
#include "PointwiseFunctions/Hydro/Tags.hpp" | ||
#include "PointwiseFunctions/InitialDataUtilities/Background.hpp" | ||
#include "PointwiseFunctions/InitialDataUtilities/InitialGuess.hpp" | ||
#include "PointwiseFunctions/MathFunctions/Factory.hpp" | ||
#include "Utilities/ProtocolHelpers.hpp" | ||
#include "Utilities/TMPL.hpp" | ||
|
||
/// \cond | ||
namespace PUP { | ||
class er; | ||
} // namespace PUP | ||
struct Metavariables { | ||
static constexpr Options::String help{ | ||
"Find the solution for the velocity potential of" | ||
"an irrotational BNS system using fixed" | ||
"problem on fixed space-time and with a fixed" | ||
"rest-mass density (alternatively fixed " | ||
"specific enthalpy) profile."}; | ||
static constexpr size_t volume_dim = 3; | ||
using system = BnsInitialData::FirstOrderSystem; | ||
using solver = elliptic::Solver<Metavariables>; | ||
|
||
using solved_fields = typename system::primal_fields; | ||
using deriv_fields = tmpl::list<::Tags::DerivTensorCompute< | ||
tmpl::front<solved_fields>, | ||
domain::Tags::InverseJacobian<3, Frame::ElementLogical, Frame::Inertial>, | ||
domain::Tags::Mesh<3>>>; | ||
using observe_fields = tmpl::append< | ||
solved_fields, typename system::background_fields, | ||
typename solver::observe_fields, deriv_fields, | ||
tmpl::list<domain::Tags::Coordinates<volume_dim, Frame::Inertial>, | ||
::Events::Tags::ObserverDetInvJacobianCompute< | ||
Frame::ElementLogical, Frame::Inertial>, | ||
domain::Tags::RadiallyCompressedCoordinatesCompute< | ||
volume_dim, Frame::Inertial>>>; | ||
using observer_compute_tags = | ||
tmpl::list<::Events::Tags::ObserverMeshCompute<volume_dim>>; | ||
|
||
// Collect all items to store in the cache. | ||
using const_global_cache_tags = | ||
tmpl::list<domain::Tags::RadiallyCompressedCoordinatesOptions, | ||
BnsInitialData::Tags::EulerEnthalpyConstant>; | ||
struct factory_creation | ||
: tt::ConformsTo<Options::protocols::FactoryCreation> { | ||
using factory_classes = tmpl::map< | ||
tmpl::pair<DomainCreator<volume_dim>, domain_creators<volume_dim>>, | ||
tmpl::pair<elliptic::analytic_data::Background, | ||
BnsInitialData::InitialData::all_initial_data>, | ||
tmpl::pair<elliptic::analytic_data::InitialGuess, | ||
BnsInitialData::InitialData::all_initial_data>, | ||
tmpl::pair<elliptic::analytic_data::AnalyticSolution, tmpl::list<>>, | ||
tmpl::pair<elliptic::BoundaryConditions::BoundaryCondition<volume_dim>, | ||
BnsInitialData::BoundaryConditions:: | ||
standard_boundary_conditions<system>>, | ||
tmpl::pair< | ||
::amr::Criterion, | ||
::amr::Criteria::standard_criteria< | ||
volume_dim, tmpl::list<BnsInitialData::Tags::VelocityPotential< | ||
DataVector>>>>, | ||
tmpl::pair<Trigger, elliptic::Triggers::all_triggers< | ||
::amr::OptionTags::AmrGroup>>, | ||
tmpl::pair<Event, | ||
tmpl::flatten<tmpl::list< | ||
Events::Completion, | ||
dg::Events::field_observations< | ||
volume_dim, observe_fields, observer_compute_tags, | ||
LinearSolver::multigrid::Tags::IsFinestGrid>>>>, | ||
tmpl::pair< | ||
PhaseChange, | ||
tmpl::list< | ||
PhaseControl::VisitAndReturn<Parallel::Phase::BuildMatrix>, | ||
// Phases for AMR | ||
PhaseControl::VisitAndReturn< | ||
Parallel::Phase::EvaluateAmrCriteria>, | ||
PhaseControl::VisitAndReturn<Parallel::Phase::AdjustDomain>, | ||
PhaseControl::VisitAndReturn<Parallel::Phase::CheckDomain>>>>; | ||
}; | ||
|
||
// Collect all reduction tags for observers | ||
using observed_reduction_data_tags = | ||
observers::collect_reduction_data_tags<tmpl::flatten<tmpl::list< | ||
tmpl::at<typename factory_creation::factory_classes, Event>, | ||
solver>>>; | ||
|
||
using initialization_actions = | ||
tmpl::push_back<typename solver::initialization_actions, | ||
Parallel::Actions::TerminatePhase>; | ||
|
||
using register_actions = | ||
tmpl::push_back<typename solver::register_actions, | ||
observers::Actions::RegisterEventsWithObservers>; | ||
|
||
using solve_actions = typename solver::template solve_actions<tmpl::list<>>; | ||
|
||
using dg_element_array = elliptic::DgElementArray< | ||
Metavariables, | ||
tmpl::list< | ||
Parallel::PhaseActions<Parallel::Phase::Initialization, | ||
initialization_actions>, | ||
Parallel::PhaseActions< | ||
Parallel::Phase::Register, | ||
tmpl::push_back<register_actions, | ||
Parallel::Actions::TerminatePhase>>, | ||
Parallel::PhaseActions<Parallel::Phase::Solve, solve_actions>, | ||
Parallel::PhaseActions<Parallel::Phase::CheckDomain, | ||
tmpl::list<::amr::Actions::SendAmrDiagnostics, | ||
Parallel::Actions::TerminatePhase>>, | ||
Parallel::PhaseActions< | ||
Parallel::Phase::BuildMatrix, | ||
tmpl::push_back<typename solver::build_matrix_actions, | ||
Parallel::Actions::TerminatePhase>>>, | ||
LinearSolver::multigrid::ElementsAllocator< | ||
volume_dim, typename solver::multigrid::options_group>>; | ||
|
||
struct amr : tt::ConformsTo<::amr::protocols::AmrMetavariables> { | ||
using element_array = dg_element_array; | ||
using projectors = typename solver::amr_projectors; | ||
}; | ||
struct registration | ||
: tt::ConformsTo<Parallel::protocols::RegistrationMetavariables> { | ||
using element_registrars = | ||
tmpl::map<tmpl::pair<dg_element_array, register_actions>>; | ||
}; | ||
|
||
// Specify all parallel components that will execute actions at some point. | ||
using component_list = tmpl::flatten< | ||
tmpl::list<dg_element_array, typename solver::component_list, | ||
observers::Observer<Metavariables>, | ||
observers::ObserverWriter<Metavariables>>>; | ||
|
||
static constexpr std::array<Parallel::Phase, 4> default_phase_order{ | ||
{Parallel::Phase::Initialization, Parallel::Phase::Register, | ||
Parallel::Phase::Solve, Parallel::Phase::Exit}}; | ||
|
||
// NOLINTNEXTLINE(google-runtime-references) | ||
void pup(PUP::er& /*p*/) {} | ||
}; | ||
/// \endcond |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Elliptic/Systems/BnsInitialData/BoundaryConditions/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
#include "Elliptic/Systems/BnsInitialData/Tags.hpp" | ||
#include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp" | ||
#include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp" | ||
#include "PointwiseFunctions/Hydro/Tags.hpp" | ||
#include "Utilities/ProtocolHelpers.hpp" | ||
#include "Utilities/TMPL.hpp" | ||
|
||
|
@@ -76,6 +77,7 @@ struct FirstOrderSystem | |
::Tags::Flux<velocity_potential, tmpl::size_t<3>, Frame::Inertial>>; | ||
|
||
using background_fields = tmpl::list< | ||
hydro::Tags::RestMassDensity<DataVector>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where is this used? |
||
gr::Tags::InverseSpatialMetric<DataVector, 3>, | ||
gr::Tags::SpatialChristoffelSecondKindContracted<DataVector, 3>, | ||
gr::Tags::Lapse<DataVector>, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space at the beginning or end of each line. Also, this sentence seems a little off, maybe delete "using fixed problem".