Skip to content
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

Executable for MC: initialize background #6355

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/DataStructures/Variables.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,11 @@ class Variables<tmpl::list<>> {
template <typename T>
Variables(const T* /*pointer*/, const size_t /*size*/) {}
static constexpr size_t size() { return 0; }
static constexpr size_t number_of_grid_points() { return 0; }
void assign_subset(const Variables<tmpl::list<>>& /*unused*/) {}
void assign_subset(const tuples::TaggedTuple<>& /*unused*/) {}
// Initialization for empty variables should ignore any input.
void initialize(size_t /*number_of_grid_points*/) {}
};

// gcc8 screams when the empty Variables has pup as a member function, so we
Expand Down
3 changes: 2 additions & 1 deletion src/Evolution/DgSubcell/Actions/Initialize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ struct SetSubcellGrid {
subcell::Tags::ReconstructionOrder<Dim>,
evolution::dg::subcell::Tags::InterpolatorsFromFdToNeighborFd<Dim>,
evolution::dg::subcell::Tags::InterpolatorsFromDgToNeighborFd<Dim>,
evolution::dg::subcell::Tags::InterpolatorsFromNeighborDgToFd<Dim>>;
evolution::dg::subcell::Tags::InterpolatorsFromNeighborDgToFd<Dim>,
typename System::variables_tag>;
using compute_tags =
tmpl::list<Tags::MeshCompute<Dim>, Tags::LogicalCoordinatesCompute<Dim>,
::domain::Tags::MappedCoordinates<
Expand Down
33 changes: 20 additions & 13 deletions src/Evolution/DgSubcell/BackgroundGrVars.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,13 @@ struct BackgroundGrVars : tt::ConformsTo<db::protocols::Mutator> {
cell_centered_impl(active_gr_vars, time, subcell_inertial_coords,
solution_or_data);
}

face_centered_impl(subcell_face_gr_vars, time, functions_of_time,
logical_to_grid_map, grid_to_inertial_map,
subcell_mesh, solution_or_data);
if constexpr (not std::is_same_v<
typename SubcellFaceGrVars::value_type::tags_list,
tmpl::list<>>){
face_centered_impl(subcell_face_gr_vars, time, functions_of_time,
logical_to_grid_map, grid_to_inertial_map,
subcell_mesh, solution_or_data);
}
}
}

Expand All @@ -158,19 +161,23 @@ struct BackgroundGrVars : tt::ConformsTo<db::protocols::Mutator> {
"The subcell mesh must have isotropic basis, quadrature. and "
"extents but got "
<< subcell_mesh);
const size_t num_face_centered_mesh_grid_pts =
(subcell_mesh.extents(0) + 1) * subcell_mesh.extents(1) *
subcell_mesh.extents(2);
for (size_t d = 0; d < volume_dim; ++d) {
gsl::at(*subcell_face_gr_vars, d)
.initialize(num_face_centered_mesh_grid_pts);
if constexpr (not std::is_same_v<
typename SubcellFaceGrVars::value_type::tags_list,
tmpl::list<>>){
const size_t num_face_centered_mesh_grid_pts =
(subcell_mesh.extents(0) + 1) * subcell_mesh.extents(1) *
subcell_mesh.extents(2);
for (size_t d = 0; d < volume_dim; ++d) {
gsl::at(*subcell_face_gr_vars, d)
.initialize(num_face_centered_mesh_grid_pts);
}
face_centered_impl(subcell_face_gr_vars, time, functions_of_time,
logical_to_grid_map, grid_to_inertial_map,
subcell_mesh, solution_or_data);
}

cell_centered_impl(inactive_gr_vars, time, subcell_inertial_coords,
solution_or_data);
face_centered_impl(subcell_face_gr_vars, time, functions_of_time,
logical_to_grid_map, grid_to_inertial_map,
subcell_mesh, solution_or_data);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
# See LICENSE.txt for details.

add_subdirectory(M1Grey)
add_subdirectory(MonteCarlo)
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Distributed under the MIT License.
# See LICENSE.txt for details.

set(EXECUTABLE EvolveMonteCarlo)

add_spectre_executable(
${EXECUTABLE}
EXCLUDE_FROM_ALL
EvolveMonteCarlo.cpp
)

target_link_libraries(
${EXECUTABLE}
PRIVATE
Actions
Charmxx::main
CoordinateMaps
DataStructures
DgSubcell
DiscontinuousGalerkin
DomainCreators
Events
EventsAndDenseTriggers
EventsAndTriggers
Evolution
GeneralRelativity
GeneralRelativitySolutions
GrMhdAnalyticData
GrMhdSolutions
H5
Hydro
Informer
LinearOperators
MathFunctions
MonteCarlo
Observer
Options
Parallel
PhaseControl
Serialization
Time
Utilities
ValenciaDivClean
)

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Distributed under the MIT License.
// See LICENSE.txt for details.

#include "Evolution/Executables/RadiationTransport/MonteCarlo/EvolveMonteCarlo.hpp"

#include <vector>

#include "Domain/Creators/RegisterDerivedWithCharm.hpp"
#include "Domain/Creators/TimeDependence/RegisterDerivedWithCharm.hpp"
#include "Domain/FunctionsOfTime/RegisterDerivedWithCharm.hpp"
#include "Parallel/CharmMain.tpp"
#include "PointwiseFunctions/Hydro/EquationsOfState/RegisterDerivedWithCharm.hpp"
#include "Utilities/Serialization/RegisterDerivedClassesWithCharm.hpp"

void register_neutrino_tables() {
register_classes_with_charm(
tmpl::list<Particles::MonteCarlo::NeutrinoInteractionTable<2, 2>,
Particles::MonteCarlo::NeutrinoInteractionTable<2, 3>,
Particles::MonteCarlo::NeutrinoInteractionTable<4, 3>,
Particles::MonteCarlo::NeutrinoInteractionTable<16, 3>>{});
}

extern "C" void CkRegisterMainModule() {
Parallel::charmxx::register_main_module<EvolutionMetavars<4, 3>>();
Parallel::charmxx::register_init_node_and_proc(
{&domain::creators::register_derived_with_charm,
&domain::creators::time_dependence::register_derived_with_charm,
&domain::FunctionsOfTime::register_derived_with_charm,
&EquationsOfState::register_derived_with_charm,
&register_factory_classes_with_charm<EvolutionMetavars<4, 3>>,
&register_neutrino_tables},
{});
}
Loading
Loading