Version: SMASH-3.2
modusdefault.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2013-2022,2024
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 
10 #ifndef SRC_INCLUDE_SMASH_MODUSDEFAULT_H_
11 #define SRC_INCLUDE_SMASH_MODUSDEFAULT_H_
12 
13 #include <map>
14 #include <memory>
15 #include <vector>
16 
17 #include "configuration.h"
18 #include "forwarddeclarations.h"
19 #include "fourvector.h"
20 #include "grandcan_thermalizer.h"
21 #include "grid.h"
22 #include "icparameters.h"
23 #include "outputinterface.h"
24 #include "potentials.h"
25 
26 namespace smash {
45 class ModusDefault {
46  public:
47  // Never needs a virtual destructor.
48 
49  // Missing functions for concrete Modus implementations:
50  // \todo(JB): Why is the function below commented out?
51  // double initial_conditions(Particles *particles);
52 
61  const OutputsList& /*out_list*/ = {}) {
62  return 0;
63  }
64 
66  bool is_collider() const { return false; }
68  bool is_box() const { return false; }
70  bool is_list() const { return false; }
72  bool is_sphere() const { return false; }
74  double sqrt_s_NN() const { return 0.; }
76  double impact_parameter() const { return -1.; }
78  void sample_impact() const {}
81  double velocity_projectile() const { return 0.0; }
84  double velocity_target() const { return 0.0; }
89  double max_timestep(double) const { return -1.; }
91  double equilibration_time() const { return -1.; }
93  double length() const { return -1.; }
95  double radius() const { return -1.; }
98  bool calculation_frame_is_fixed_target() const { return false; }
108  double nuclei_passing_time() const { return 0.0; }
110  bool is_IC_for_hybrid() const { return false; }
113  throw std::logic_error(
114  "Only ColliderModus has parameters for initial conditions.");
115  }
117  const std::map<int32_t, double>& fluid_background() {
118  throw std::logic_error("Only ColliderModus has a fluid background.");
119  }
122  throw std::logic_error("Only ColliderModus has a fluid lattice.");
123  }
124 
133  [[maybe_unused]] const double t,
134  [[maybe_unused]] const std::vector<Particles>& ensembles,
135  [[maybe_unused]] const DensityParameters& dens_par) {}
155  const Particles& particles, double min_cell_length,
156  double timestep_duration, CollisionCriterion crit,
157  const bool include_unformed_particles,
158  CellSizeStrategy strategy = CellSizeStrategy::Optimal) const {
160  if (crit == CollisionCriterion::Stochastic) {
162  }
163  return {particles,
164  min_cell_length,
165  timestep_duration,
166  limit,
167  include_unformed_particles,
168  strategy};
169  }
170 
177  std::unique_ptr<GrandCanThermalizer> create_grandcan_thermalizer(
178  Configuration& conf) const {
179  /* Lattice is placed such that the center is 0,0,0.
180  If one wants to have a central cell with center at 0,0,0 then
181  number of cells should be odd (2k+1) in every direction.
182  */
183  const std::array<double, 3> l =
185  const std::array<double, 3> origin = {-0.5 * l[0], -0.5 * l[1],
186  -0.5 * l[2]};
187  const bool periodicity = false;
188  return std::make_unique<GrandCanThermalizer>(conf, l, origin, periodicity);
189  }
190 
195  struct BadInput : public std::invalid_argument {
196  using std::invalid_argument::invalid_argument;
197  };
203  struct InvalidEnergy : public BadInput {
204  using BadInput::BadInput;
205  };
206 };
207 
208 } // namespace smash
209 
210 #endif // SRC_INCLUDE_SMASH_MODUSDEFAULT_H_
Interface to the SMASH configuration files.
T take(const Key< T > &key)
The default interface for SMASH to read configuration values.
A class to pre-calculate and store parameters relevant for density calculation.
Definition: density.h:92
Abstracts a list of cells that partition the particles in the experiment into regions of space that c...
Definition: grid.h:96
Base class for Modus classes that provides default function implementations.
Definition: modusdefault.h:45
const RectangularLattice< EnergyMomentumTensor > & fluid_lattice()
Definition: modusdefault.h:121
bool calculation_frame_is_fixed_target() const
Definition: modusdefault.h:98
double radius() const
Definition: modusdefault.h:95
std::unique_ptr< GrandCanThermalizer > create_grandcan_thermalizer(Configuration &conf) const
Creates GrandCanThermalizer.
Definition: modusdefault.h:177
bool is_list() const
Definition: modusdefault.h:70
double velocity_target() const
Definition: modusdefault.h:84
int impose_boundary_conditions(Particles *, const OutputsList &={})
Enforces sensible positions for the particles.
Definition: modusdefault.h:60
double max_timestep(double) const
Definition: modusdefault.h:89
bool is_box() const
Definition: modusdefault.h:68
double nuclei_passing_time() const
Get the passing time of the two nuclei in a collision.
Definition: modusdefault.h:108
void build_fluidization_lattice([[maybe_unused]] const double t, [[maybe_unused]] const std::vector< Particles > &ensembles, [[maybe_unused]] const DensityParameters &dens_par)
Build lattice of energy momentum tensor.
Definition: modusdefault.h:132
FermiMotion fermi_motion() const
Definition: modusdefault.h:87
bool is_sphere() const
Definition: modusdefault.h:72
double velocity_projectile() const
Definition: modusdefault.h:81
bool is_IC_for_hybrid() const
Definition: modusdefault.h:110
double sqrt_s_NN() const
Definition: modusdefault.h:74
double impact_parameter() const
Definition: modusdefault.h:76
bool is_collider() const
Definition: modusdefault.h:66
void sample_impact() const
sample impact parameter for collider modus
Definition: modusdefault.h:78
double equilibration_time() const
Definition: modusdefault.h:91
const InitialConditionParameters & IC_parameters() const
Definition: modusdefault.h:112
const std::map< int32_t, double > & fluid_background()
Definition: modusdefault.h:117
Grid< GridOptions::Normal > create_grid(const Particles &particles, double min_cell_length, double timestep_duration, CollisionCriterion crit, const bool include_unformed_particles, CellSizeStrategy strategy=CellSizeStrategy::Optimal) const
Creates the Grid with normal boundary conditions.
Definition: modusdefault.h:154
double length() const
Definition: modusdefault.h:93
The Particles class abstracts the storage and manipulation of particles.
Definition: particles.h:33
A container class to hold all the arrays on the lattice and access them.
Definition: lattice.h:49
FermiMotion
Option to use Fermi Motion.
@ Off
Don't use fermi motion.
CollisionCriterion
Criteria used to check collisions.
@ Stochastic
Stochastic Criteiron.
Definition: action.h:24
CellNumberLimitation
Identifies whether the number of cells should be limited.
Definition: grid.h:55
@ ParticleNumber
Limit the number of cells to the number of particles.
@ None
No cell number limitation.
CellSizeStrategy
Indentifies the strategy of determining the cell size.
Definition: grid.h:33
@ Optimal
Look for optimal cell size.
At the moment there are two ways to specify input for initial conditions in the configuration,...
Definition: icparameters.h:21
static const Key< std::array< double, 3 > > forcedThermalization_latticeSizes
See user guide description for more information.
Definition: input_keys.h:5644
BadInput is an error to throw if the configuration options are invalid.
Definition: modusdefault.h:195
Thrown when the requested energy is smaller than the masses of two particles.
Definition: modusdefault.h:203