diff --git a/src/Evolution/Executables/RadiationTransport/MonteCarlo/EvolveMonteCarlo.hpp b/src/Evolution/Executables/RadiationTransport/MonteCarlo/EvolveMonteCarlo.hpp index 90e8f17af930c..8f90a3c796749 100644 --- a/src/Evolution/Executables/RadiationTransport/MonteCarlo/EvolveMonteCarlo.hpp +++ b/src/Evolution/Executables/RadiationTransport/MonteCarlo/EvolveMonteCarlo.hpp @@ -128,11 +128,9 @@ struct EvolutionMetavars { static constexpr bool subcell_enabled_at_external_boundary = true; }; - using observe_fields = tmpl::list< - // tmpl::push_back< - // tmpl::append, - domain::Tags::Coordinates, - domain::Tags::Coordinates>; + using observe_fields = + tmpl::list, + domain::Tags::Coordinates>; using non_tensor_compute_tags = tmpl::list<::Events::Tags::ObserverMeshCompute, ::Events::Tags::ObserverDetInvJacobianCompute< @@ -147,21 +145,14 @@ struct EvolutionMetavars { using factory_classes = tmpl::map< tmpl::pair, tmpl::pair, domain_creators>, - tmpl::pair< - Event, - tmpl::flatten //, - // Events::time_events - >>>, + tmpl::pair>>, tmpl::pair, tmpl::pair< grmhd::AnalyticData::InitialMagneticFields::InitialMagneticField, grmhd::AnalyticData::InitialMagneticFields:: initial_magnetic_fields>, - tmpl::pair, + tmpl::pair>, tmpl::pair, StepChoosers::standard_slab_choosers>, tmpl::pair, @@ -169,33 +160,13 @@ struct EvolutionMetavars { tmpl::pair, TimeSequences::all_time_sequences>, tmpl::pair, - tmpl::pair>>; + tmpl::pair>; }; using observed_reduction_data_tags = observers::collect_reduction_data_tags>>>; - using step_actions = tmpl::flatten, - // Particles::MonteCarlo::Actions::SendDataForMcCommunication< - // volume_dim, - // No local time stepping - // false, Particles::MonteCarlo::CommunicationStep::PreStep>, - // Particles::MonteCarlo::Actions::ReceiveDataForMcCommunication< - // volume_dim, Particles::MonteCarlo::CommunicationStep::PreStep>, - Particles::MonteCarlo::Actions::TakeTimeStep, - // Particles::MonteCarlo::Actions::SendDataForMcCommunication< - // volume_dim, - // No local time stepping - // false, Particles::MonteCarlo::CommunicationStep::PostStep>, - // Particles::MonteCarlo::Actions::ReceiveDataForMcCommunication< - // volume_dim, Particles::MonteCarlo::CommunicationStep::PostStep>, - // Actions::RecordTimeStepperData, - // evolution::Actions::RunEventsAndDenseTriggers>, - Actions::CleanHistory>>; - using dg_registration_list = tmpl::list; @@ -203,7 +174,6 @@ struct EvolutionMetavars { Initialization::Actions::InitializeItems< Initialization::TimeStepping, evolution::dg::Initialization::Domain //, - // Initialization::TimeStepperHistory >, Initialization::Actions::AddSimpleTags< evolution::dg::BackgroundGrVars>, @@ -219,7 +189,7 @@ struct EvolutionMetavars { hydro::Tags::LowerSpatialFourVelocityCompute, Particles::MonteCarlo::InverseJacobianInertialToFluidCompute, domain::Tags::JacobianCompute<4, Frame::Inertial, Frame::Fluid>>>, - // Initialization::TimeStepperHistory + evolution::Actions::InitializeRunEventsAndDenseTriggers, Parallel::Actions::TerminatePhase>; using dg_element_array = DgElementArray< @@ -227,19 +197,15 @@ struct EvolutionMetavars { tmpl::list< Parallel::PhaseActions, - // Parallel::PhaseActions< - // Parallel::Phase::InitializeTimeStepperHistory, - // SelfStart::self_start_procedure>, - - // Parallel::PhaseActions>, - Parallel::PhaseActions< Parallel::Phase::Evolve, tmpl::list< - Actions::AdvanceTime, Actions::AdvanceTime, Actions::AdvanceTime, + evolution::Actions::RunEventsAndTriggers, + Actions::AdvanceTime, + evolution::Actions::RunEventsAndTriggers, + Actions::AdvanceTime, + evolution::Actions::RunEventsAndTriggers, Particles::MonteCarlo::Actions::SendDataForMcCommunication< volume_dim, // No local time stepping @@ -257,12 +223,7 @@ struct EvolutionMetavars { Particles::MonteCarlo::Actions::ReceiveDataForMcCommunication< volume_dim, Particles::MonteCarlo::CommunicationStep::PostStep>, - Parallel::Actions::TerminatePhase>> - // tmpl::list> - >>; + PhaseControl::Actions::ExecutePhaseChange>>>>; struct registration : tt::ConformsTo { diff --git a/src/Evolution/Particles/MonteCarlo/Actions/InitializeMonteCarlo.hpp b/src/Evolution/Particles/MonteCarlo/Actions/InitializeMonteCarlo.hpp index ae7f91fd84839..f5ecaf298f3be 100644 --- a/src/Evolution/Particles/MonteCarlo/Actions/InitializeMonteCarlo.hpp +++ b/src/Evolution/Particles/MonteCarlo/Actions/InitializeMonteCarlo.hpp @@ -3,9 +3,11 @@ #pragma once +#include #include #include "DataStructures/DataBox/DataBox.hpp" +#include "Domain/Structure/Element.hpp" #include "Domain/Tags.hpp" #include "Evolution/Initialization/InitialData.hpp" #include "Evolution/Particles/MonteCarlo/GhostZoneCommunicationTags.hpp" @@ -115,8 +117,10 @@ struct InitializeMCTags { tmpl::list>( make_not_null(&box), std::move(all_packets)); - // Currently seeds with 0 for testing... - typename Particles::MonteCarlo::Tags::RandomNumberGenerator::type rng(0); + unsigned long seed = + std::random_device{}(); // static_cast(time(NULL)); + typename Particles::MonteCarlo::Tags::RandomNumberGenerator::type rng(seed); + Initialization::mutate_assign< tmpl::list>( make_not_null(&box), std::move(rng)); diff --git a/src/Evolution/Particles/MonteCarlo/EvolvePacketsInElement.tpp b/src/Evolution/Particles/MonteCarlo/EvolvePacketsInElement.tpp index 3abfe9d8d0725..effa473212c19 100644 --- a/src/Evolution/Particles/MonteCarlo/EvolvePacketsInElement.tpp +++ b/src/Evolution/Particles/MonteCarlo/EvolvePacketsInElement.tpp @@ -162,6 +162,22 @@ void TemplatedLocalFunctions::evolve_packets( initial_time = packet.time; dt_end_step = final_time - initial_time; + // Find closest grid point to packet at current time, using + // extents for live points only. + { + std::array closest_point_index_3d{0, 0, 0}; + for (size_t d = 0; d < 3; d++) { + gsl::at(closest_point_index_3d, d) = + std::floor((packet.coordinates[d] - gsl::at(bottom_coord_mesh, d)) / + gsl::at(dx_mesh, d) + + 0.5); + } + packet.index_of_closest_grid_point = + closest_point_index_3d[0] + + extents[0] * (closest_point_index_3d[1] + + extents[1] * closest_point_index_3d[2]); + } + // Get quantities that we do NOT update if the packet // changes cell. // local_idx is the index on the mesh without ghost zones diff --git a/src/ParallelAlgorithms/Events/ObserveTimeStep.hpp b/src/ParallelAlgorithms/Events/ObserveTimeStep.hpp index 9b727f56ca560..63751cb189d01 100644 --- a/src/ParallelAlgorithms/Events/ObserveTimeStep.hpp +++ b/src/ParallelAlgorithms/Events/ObserveTimeStep.hpp @@ -165,17 +165,18 @@ class ObserveTimeStep : public Event { // We obtain the grid size from the variables, rather than the mesh, // so that this observer is not DG-specific. using argument_tags = - tmpl::list<::Tags::TimeStep, typename System::variables_tag>; + tmpl::list<::Tags::TimeStep>; //, typename System::variables_tag>; template void operator()(const TimeDelta& time_step, - const typename System::variables_tag::type& variables, + // const typename System::variables_tag::type& variables, Parallel::GlobalCache& cache, const ArrayIndex& array_index, const ParallelComponent* const /*meta*/, const ObservationValue& observation_value) const { - const size_t number_of_grid_points = variables.number_of_grid_points(); + const size_t number_of_grid_points = + 1; // variables.number_of_grid_points(); const double slab_size = time_step.slab().duration().value(); const double step_size = abs(time_step.value()); const double wall_time = sys::wall_time();