Version 2, position dependent E/B, kinetic ions, boris mover, terminator

This commit is contained in:
Jonas Kellerer
2022-10-21 10:09:19 +02:00
parent acc55cf003
commit 83fd2e5d7e
869 changed files with 1033204 additions and 3634436 deletions
+24
View File
@@ -0,0 +1,24 @@
#ifndef BINNING_GENERATOR_H
#define BINNING_GENERATOR_H
#include <memory>
#include "blitz/array.h"
#include "simulation/energy_binning.h"
#include "simulation/parameter.h"
#include "simulation/position_binning.h"
namespace generator {
CylinderBinning buildPositionBinning(json_t* object);
CylinderBinning buildPositionBinningIncludingRedirection(
Parameter& parameter,
json_path& path_to_binning);
EnergyBinning buildEnergyBinning(json_t* object);
EnergyBinning buildEnergyBinningIncludingRedirection(
Parameter& parameter,
json_path& path_to_binning);
}; // namespace generator
#endif /* BINNING_GENERATOR_H */
+17
View File
@@ -0,0 +1,17 @@
#ifndef CURRENT_COLLECTOR_GENERATOR_H
#define CURRENT_COLLECTOR_GENERATOR_H
#include <memory>
#include "simulation/current_collector.h"
#include "simulation/jansson_additionals.h"
#include "simulation/parameter.h"
#include "simulation/timer.h"
namespace generator {
std::shared_ptr<CurrentCollector> buildCurrentCollector(
Parameter& parameter,
const json_path& path_to_collector,
std::shared_ptr<Timer>& timer);
};
#endif /* CURRENT_COLLECTOR_GENERATOR_H */
+20
View File
@@ -0,0 +1,20 @@
#ifndef DENSITY_FIELD_GENERATOR_H
#define DENSITY_FIELD_GENERATOR_H
#include "simulation/density_field.h"
#include "simulation/jansson_additionals.h"
#include "simulation/parameter.h"
#include "simulation/timer.h"
namespace generator {
std::shared_ptr<ConstantDensityField> buildConstantDensityField(json_t* object);
std::shared_ptr<DynamicDensityField> buildDynamicDensityField(
Parameter& parameter,
const json_path& path_to_field,
std::shared_ptr<Timer>& timer);
}; // namespace generator
#endif /* DENSITY_FIELD_GENERATOR_H */
+16
View File
@@ -0,0 +1,16 @@
#ifndef DRIFT_VELOCITY_GENERATOR_H
#define DRIFT_VELOCITY_GENERATOR_H
#include "simulation/drift_velocity.h"
#include "simulation/jansson_additionals.h"
#include "simulation/parameter.h"
namespace generator {
std::shared_ptr<DriftVelocity> buildDriftVelocity(
Parameter& parameter,
const json_path& path_to_drift_velocity);
};
#endif /* DRIFT_VELOCITY_GENERATOR_H */
+14
View File
@@ -0,0 +1,14 @@
#ifndef ELECTRIC_FIELD_GENERATOR_H
#define ELECTRIC_FIELD_GENERATOR_H
#include "simulation/electromagnetic_field.h"
#include "simulation/parameter.h"
namespace generator {
std::shared_ptr<ElectricField> electricField(json_t* object);
std::shared_ptr<ElectricField> electricField(Parameter& parameter);
}; // namespace generator
#endif /* ELECTRIC_FIELD_GENERATOR_H */
@@ -0,0 +1,17 @@
#ifndef ENERGY_DISTRIBUTION_FUNCTION_GENERATOR_H
#define ENERGY_DISTRIBUTION_FUNCTION_GENERATOR_H
#include <memory>
#include "simulation/energy_distribution.h"
#include "simulation/jansson_additionals.h"
#include "simulation/parameter.h"
namespace generator {
std::shared_ptr<EnergyDistributionFunction> buildEnergyDistributionFunction(
Parameter& parameter,
const json_path& path_to_function);
};
#endif /* ENERGY_DISTRIBUTION_FUNCTION_GENERATOR_H */
+15
View File
@@ -0,0 +1,15 @@
#ifndef FUNCTION_GENERATOR_H
#define FUNCTION_GENERATOR_H
#include <functional>
#include "functions/functions.h"
#include "jansson.h"
namespace generator {
std::function<double(double)> function1D(json_t* object);
std::function<double(double, double, double)> function3D(json_t* object);
}; // namespace generator
#endif /* FUNCTION_GENERATOR_H */
+17
View File
@@ -0,0 +1,17 @@
#ifndef GEOMETRY_GENERATOR_H
#define GEOMETRY_GENERATOR_H
#include <memory>
#include "simulation/geometry.h"
#include "simulation/jansson_additionals.h"
#include "simulation/parameter.h"
namespace generator {
std::shared_ptr<Geometry> buildGeometry(Parameter& parameter,
const json_path& path_to_geometry);
};
#endif /* GEOMETRY_GENERATOR_H */
+22
View File
@@ -0,0 +1,22 @@
#ifndef INJECTOR_GENERATOR_H
#define INJECTOR_GENERATOR_H
#include <map>
#include <memory>
#include "simulation/injector.h"
#include "simulation/jansson_additionals.h"
#include "simulation/parameter.h"
#include "simulation/species.h"
namespace generator {
std::shared_ptr<Injector> buildInjector(
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
tracked_species,
std::map<std::string, std::shared_ptr<species::BackgroundSpecie>>&
background_species,
Parameter& parameter);
};
#endif /* INJECTOR_GENERATOR_H */
+49
View File
@@ -0,0 +1,49 @@
#ifndef INTERACTION_GENERATOR_H
#define INTERACTION_GENERATOR_H
#include <functional>
#include <map>
#include <memory>
#include <string>
#include "simulation/jansson_additionals.h"
#include "simulation/parameter.h"
#include "simulation/scattering_angle_distribution.h"
#include "simulation/species.h"
namespace generator {
void addInteractions(
std::shared_ptr<species::TrackedSpecie> specie,
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
tracked_species,
std::map<std::string, std::shared_ptr<species::BackgroundSpecie>>&
background_species,
Parameter& parameter,
json_path& path_to_interactions);
std::function<double(double)> buildTotalCrossSection(json_t* object);
std::function<double(double, double)> build2DCrossSection(json_t* object);
std::shared_ptr<ScatteringAngleDistribution> buildScatteringAngleDistribution(
json_t* object);
double buildExcitationEnergy(std::string excitation_state);
std::function<double(double)> buildExcitationCrossSection(
std::string excitation_state);
std::shared_ptr<species::Specie> findTarget(
std::string& target_name,
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
tracked_species,
std::map<std::string, std::shared_ptr<species::BackgroundSpecie>>&
background_species);
std::shared_ptr<species::TrackedSpecie> findTracked(
std::string& target_name,
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
tracked_species);
}; // namespace generator
#endif /* INTERACTION_GENERATOR_H */
+17
View File
@@ -0,0 +1,17 @@
#ifndef LOGGER_GENERATOR_H
#define LOGGER_GENERATOR_H
#include <memory>
#include "simulation/logger.h"
#include "simulation/parameter.h"
namespace generator {
std::shared_ptr<DeletionLogger> buildDeletionLogger(json_t* object);
std::shared_ptr<DeletionLogger> buildDeletionLogger(
Parameter& parameter,
const json_path& path_to_logger);
} // namespace generator
#endif /* LOGGER_GENERATOR_H */
+14
View File
@@ -0,0 +1,14 @@
#ifndef MAGNETIC_FIELD_GENERATOR_H
#define MAGNETIC_FIELD_GENERATOR_H
#include "simulation/electromagnetic_field.h"
#include "simulation/parameter.h"
namespace generator {
std::shared_ptr<MagneticField> magneticField(json_t* object);
std::shared_ptr<MagneticField> magneticField(Parameter& parameter);
}; // namespace generator
#endif /* MAGNETIC_FIELD_GENERATOR_H */
+25
View File
@@ -0,0 +1,25 @@
#ifndef MASS_GENERATOR_H
#define MASS_GENERATOR_H
#include <map>
#include "jansson.h"
namespace species {
enum class ImplementedSpecies;
};
namespace generator {
class SpeciesMasses {
public:
static double mass(const species::ImplementedSpecies& species);
private:
static std::map<species::ImplementedSpecies, double> mass_;
};
double buildMass(json_t* object);
}; // namespace generator
#endif /* MASS_GENERATOR_H */
+15
View File
@@ -0,0 +1,15 @@
#ifndef MOVER_GENERATOR_H
#define MOVER_GENERATOR_H
#include "simulation/jansson_additionals.h"
#include "simulation/mover.h"
#include "simulation/parameter.h"
namespace generator {
std::shared_ptr<Mover> buildMover(Parameter& parameter,
const json_path& path_to_mover);
};
#endif /* MOVER_GENERATOR_H */
+14
View File
@@ -0,0 +1,14 @@
#ifndef RANDOM_NUMBERS_GENERATOR_H
#define RANDOM_NUMBERS_GENERATOR_H
#include <memory>
#include "simulation/parameter.h"
#include "simulation/random_numbers.h"
namespace generator {
std::shared_ptr<RandomNumbers> buildRandomNumbers(Parameter& parameter);
};
#endif /* RANDOM_NUMBERS_GENERATOR_H */
+17
View File
@@ -0,0 +1,17 @@
#ifndef REFLECTOR_GENERATOR_H
#define REFLECTOR_GENERATOR_H
#include <memory>
#include "simulation/jansson_additionals.h"
#include "simulation/parameter.h"
#include "simulation/reflector.h"
namespace generator {
std::shared_ptr<Reflector> buildReflector(Parameter& parameter,
const json_path& path_to_reflector);
};
#endif /* REFLECTOR_GENERATOR_H */
+13
View File
@@ -0,0 +1,13 @@
#ifndef SCALAR_FIELD_GENERATOR_H
#define SCALAR_FIELD_GENERATOR_H
#include <memory>
#include "jansson.h"
#include "simulation/scalar_field.h"
namespace generator {
std::shared_ptr<ScalarField> buildScalarField(json_t* object);
}
#endif /* SCALAR_FIELD_GENERATOR_H */
+23
View File
@@ -0,0 +1,23 @@
#ifndef SIMULATION_OUTPUT_GENERATOR_H
#define SIMULATION_OUTPUT_GENERATOR_H
#include <map>
#include <memory>
#include <string>
#include "jansson.h"
class SimulationOutput;
namespace species {
class TrackedSpecie;
};
namespace generator {
std::shared_ptr<SimulationOutput> buildSimulationOutput(
json_t* object,
const std::map<std::string, std::shared_ptr<species::TrackedSpecie>>&
tracked_species);
}; // namespace generator
#endif /* SIMULATION_OUTPUT_GENERATOR_H */
+115
View File
@@ -0,0 +1,115 @@
#ifndef SPECIES_GENERATOR_H
#define SPECIES_GENERATOR_H
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "generators/interaction_generator.h"
#include "simulation/jansson_additionals.h"
#include "simulation/parameter.h"
#include "simulation/species.h"
class Timer;
namespace generator {
struct TrackedSpeciesBuilderInfo {
public:
std::shared_ptr<Mover> mover;
std::shared_ptr<Terminator> terminator;
std::shared_ptr<Reflector> reflector;
std::shared_ptr<DynamicDensityField> density_field;
std::shared_ptr<VelocityDistribution> velocity_distribution;
std::shared_ptr<DriftVelocity> drift_velocity;
double mass_kg;
double charge_C;
species::ImplementedSpecies type;
std::string name;
json_path path_in_json;
};
struct BackgroundSpeciesBuilderInfo {
public:
BackgroundSpeciesBuilderInfo()
: density(nullptr),
velocity_distribution(nullptr),
drift_velocity(nullptr){};
std::shared_ptr<ConstantDensityField> density;
std::shared_ptr<VelocityDistribution> velocity_distribution;
std::shared_ptr<DriftVelocity> drift_velocity;
double mass_kg;
double charge_C;
species::ImplementedSpecies type;
std::string name;
json_path path_in_json;
};
class SpeciesAlias {
public:
static species::ImplementedSpecies alias(const std::string& name);
static std::string name(species::ImplementedSpecies specie);
static bool isAlias(const std::string& name);
private:
static std::map<std::string, species::ImplementedSpecies> specie_aliases;
};
class SpeciesCharges {
public:
static double charge(species::ImplementedSpecies species);
private:
static std::map<species::ImplementedSpecies, double> charge_;
};
class SpeciesBuilder {
public:
SpeciesBuilder(Parameter& parameter);
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>
trackedSpecies();
std::map<std::string, std::shared_ptr<species::BackgroundSpecie>>
backgroundSpecies();
std::shared_ptr<Timer> timer();
private:
std::map<std::string, BackgroundSpeciesBuilderInfo> background_species_info;
std::map<std::string, TrackedSpeciesBuilderInfo> tracked_species_info;
std::shared_ptr<Timer> timer_;
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>
tracked_species;
std::map<std::string, std::shared_ptr<species::BackgroundSpecie>>
background_species;
void initBackgroundSpecies(Parameter& parameter);
void initTrackedSpecies(Parameter& parameter);
void fillVelocityDistribution(Parameter& parameter);
void fillDriftVelocity(Parameter& parameter);
void fillMass();
void fillCharge();
void fillInteractions(Parameter& parameter);
void fillBackgroundSpecieType(Parameter& parameter);
void fillBackgroundDensity(Parameter& parameter);
void fillTrackedSpecieType(Parameter& parameter);
void fillCurrentCollector(Parameter& parameter);
void fillLoggers(Parameter& parameter);
void fillMover(Parameter& parameter);
void fillTerminator(Parameter& parameter);
void fillReflector(Parameter& parameter);
void fillTrackedDensity(Parameter& parameter);
void initTimer();
void buildSpecies();
};
}; // namespace generator
#endif /* SPECIES_GENERATOR_H */
+16
View File
@@ -0,0 +1,16 @@
#ifndef TERMINATOR_GENERATOR_H
#define TERMINATOR_GENERATOR_H
#include "simulation/jansson_additionals.h"
#include "simulation/parameter.h"
#include "simulation/terminator.h"
namespace generator {
std::shared_ptr<Terminator> buildTerminator(
Parameter& parameter,
const json_path& path_to_terminator);
};
#endif /* TERMINATOR_GENERATOR_H */
+17
View File
@@ -0,0 +1,17 @@
#ifndef VECTOR_FIELD_GENERATOR_H
#define VECTOR_FIELD_GENERATOR_H
#include <memory>
#include "jansson.h"
#include "simulation/parameter.h"
#include "simulation/vector_field.h"
namespace generator {
std::shared_ptr<VectorField> buildVectorField(json_t* object);
std::string readAbsoluteFilename(json_t* object);
blitz::Array<double, 3> readComponentFromFile(json_t* object, int component);
blitz::Array<double, 3> readFromFile(json_t* object);
} // namespace generator
#endif /* VECTOR_FIELD_GENERATOR_H */
@@ -0,0 +1,17 @@
#ifndef VELOCITY_DISTRIBUTION_FUNCTION_GENERATOR_H
#define VELOCITY_DISTRIBUTION_FUNCTION_GENERATOR_H
#include <memory>
#include "simulation/jansson_additionals.h"
#include "simulation/parameter.h"
#include "simulation/velocity_distribution_function.h"
namespace generator {
std::shared_ptr<VelocityDistributionFunction> buildVelocityDistributionFunction(
Parameter& parameter,
const json_path& path_to_distribution);
};
#endif /* VELOCITY_DISTRIBUTION_FUNCTION_GENERATOR_H */
+17
View File
@@ -0,0 +1,17 @@
#ifndef VELOCITY_DISTRIBUTION_GENERATOR_H
#define VELOCITY_DISTRIBUTION_GENERATOR_H
#include <memory>
#include "simulation/jansson_additionals.h"
#include "simulation/parameter.h"
#include "simulation/velocity_distribution.h"
namespace generator {
std::shared_ptr<VelocityDistribution> buildVelocityDistribution(
Parameter& parameter,
const json_path& path_to_distribution);
}; // namespace generator
#endif /* VELOCITY_DISTRIBUTION_GENERATOR_H */