Files
karl/include/generators/interaction_generator.h
csendlinger 9c999dabbb Added class for tertiary association process,
(i.e. class for density dependent cross section),
corrected some comments
2024-12-18 15:18:18 +01:00

156 lines
11 KiB
C++
Executable File

#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 {
// create the interactions specified at the "path_to_insteractions" in the Parameter
// and add them to the given TrackedSpecie specie
// the json-object at "path_to_interactions" has to consist of an arbitrary number
// of arbitrarily named json-objects describing the interaction. These objects have to contain:
// - a json-string "Type" with a value of either: "ElasticScattering", "FreeMovement", "ElectronIonization", "Excitation"
// "Clustering", "ChargeExchange" or "Recombination"
//
// if the Type "ElasticScattering" is specified (for elastic scattering interactions) the additional elements have to be present:
// - a json-object "CrossSection" (as described in "buildTotalCrossSection" function)
// - a json-object "ScatteringAngleDistribution" (as described in "buildScatteringAngleDistribution")
// - a json-string "Target", containing the interaction partner (has to be the name given in the json file
// of either a TrackedSpecie or a BackgroundSpecie)
//
// if the Type "FreeMovement" is specified (for a dummy interaction that does nothing) no additional elements have to be present
//
// if the Type is "ElectronIonization" the additional elements have to be provided:
// - a json-string "Target", containing the interaction partner (has to be the name given in the json file
// of either a TrackedSpecie or a BackgroundSpecie)
// - a json-string "OutgoingElectron", containing the name (given in the json parameter file) of
// a TrackedSpecie
// - a json-string "OutgoingIon", containing the name (given in the json parameter file) of
// a TrackedSpecie
// - a json-string "IonizationModel" with a value of either "JanevNonDiss", "JanevDissToGround" or "JanevDissToFirstExcited"
// - if the value is "IonizationModel": the "eT2_ionization_janev_non_diss" function for the cross section is used, "OutgoingElectron" has to be an electron ImplementedSpecies
// and "OutgoingIon" has to be a T2plus ImplementedSpecies, the scattering angle distribution is "IonizationScatteringAngleDistribution" and
// the energy distribution of the ionization electrons produced in the ionization is defined in "eT2_ionization_bed" (functions defined in "interations/cross_sections.h" and "interactions/ionization.h")
// - if the value is "JanevDissToGround": the "eT2_ionization_janev_diss_ground" function for the cross section is used, "OutgoingElectron" has to be an electron ImplementedSpecies
// and "OutgoingIon" has to be a Tplus ImplementedSpecies, the scattering angle distribution is "IonizationScatteringAngleDistribution" and
// the energy distribution of the ionization electrons produced in the ionization is defined in "eT2_ionization_bed" (functions defined in "interations/cross_sections.h" and "interactions/ionization.h")
// - if the value is "JanevDissToFirstExcited": the "eT2_ionization_janev_diss_first" function for the cross section is used, "OutgoingElectron" has to be an electron ImplementedSpecies
// and "OutgoingIon" has to be a Tplus ImplementedSpecies, the scattering angle distribution is "IonizationScatteringAngleDistribution" and
// the energy distribution of the ionization electrons produced in the ionization is defined in "eT2_ionization_bed" (functions defined in "interations/cross_sections.h" and "interactions/ionization.h")
//
// if the Type is "Excitation" the additiona elements have to be provided:
// - a json-string "Target", containing the interaction partner (has to be the name given in the json file
// of either a TrackedSpecie or a BackgroundSpecie)
// - a json-string "ExcitationState" being one of the names defined in "buildExcitationCrossSection"
//
// if the Type is "Clustering":
// - a json-string "Target", containing the interaction partner (has to be the name given in the json file
// of either a TrackedSpecie or a BackgroundSpecie)
// - a json-string "Product" (being a name of a tracked specie as defined in the json parameter file)
// - a json-object "CrossSection" (as described in the "buildTotalCrossSection" function)
// - a json-string "ClusteringType" specifying if the clustering is either a tertiary or radiative process
// (if tertiary is chosen the specifed cross section function is only the rate coefficient diveded by the velocity (units: m^6/s / (m/s)))
// otherwise it is handled as a "normal" cross section (m^2)
//
// if the Type is "ChargeExchange" (right now only if the species for which it's defined is the target with a charge of +1):
// - a json-string "Target", containing the interaction partner (has to be the name given in the json file
// of either a TrackedSpecie or a BackgroundSpecie)
// - a json-object "CrossSection" (as described in the "buildTotalCrossSection" function)
//
// if the Type is "Recombination" the additional elements have to be present as well:
// - a json-string "Target", containing the interaction partner (has to be the name given in the json file
// of a TrackedSpecie)
// - a json-object "CrossSection" (as described in the "buildTotalCrossSection" function)
//
// examples for the usage in a json-file can be found in simulation_config/interactions_examples.json
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);
// returns the cross section function defined in the given json-object
// the json-object has to either contain a json-string "PredefinedFunction", a json-object "1dFunction" or a json-object "ExcitationFunction"
// if the json-string "PredefinedFunction" is defined it has to have a value of one of the following strings:
// - "eT2_elastic_scattering_constant", "eT2_elastic_scattering", "TpT2_elastic_scattering_tabata", "T3pT2_elastic_scattering_tabata",
// "eT2_ionization_janev_diss_ground", "eT2_ionization_janev_diss_first", "TpT2_clustering_radiative_ascendion_pasil",
// "TpT2_clustering_tertiary_ascendion_pasil", "T2pT2_clustering_janev", "T2pT2_charge_exchange_janev", "eT2p_recombination_janev", "eT3p_recombination_janev"
// (further explanations can be found in "interactions/cross_sections.h"; the functions have the same name as the corresponding string listed above)
//
// if the json-object "1dFunction" exists, it has to follow the structure described in "generators/function_generator.h" for function1D
//
// if the json-object "ExcitationFunction" has to exist, this object has to contain a json-string called "ExcitationState",
// which has to be one of the strings defined in "buildExcitationCrossSection"
std::function<double(double)> buildTotalCrossSection(json_t* object);
// return a cross section function depending on two variables (e.g. in-going and out-going particle energies in an ionization)
// has to contain a json-string "PredefinedFunction" with a value of "eT2_ionization_bed"
// (right now the function is only defined but never used)
std::function<double(double, double)> build2DCrossSection(json_t* object);
// return a shared_ptr to a ScatteringAngleDistribution object that is defined by the given json-object
// has to contain a json-object called:
// "Isotropic". This object does not need any elements.
//
// "AngleDistributionFromFile". Has to contain a json-object "PathToH5" following the format as described in "readAbsoluteFilename"
// (defined in "generators/vector_field_generator.h")
//
// "CompositeAngleDistribution". Has to contain a
// - json-object "DeciderEnergy" following the description of "json_read_energy" (defined in "simulation/jansson_additionals.h")
// - two json-objects "LowerDistribution" and "HigherDisribuiton" as defined for this function
std::shared_ptr<ScatteringAngleDistribution> buildScatteringAngleDistribution(
json_t* object);
// return the value of the excitation energy for the given string defining the final excitation state of the target particle
// possible values for the excitation_state are (the numerical values can be found in the interaction_generatior.cpp file):
// - janev_singlet_B1, janev_singlet_B1prime, janev_singlet_B1primeprime, janev_singlet_C1, janev_singlet_D1,
// janev_singlet_D1prime, janev_singlet_symmetry_forbidden_EF1, janev_singlet_symmetry_forbidden_HHb,
// janev_singlet_symmetry_forbidden_GK1, janev_singlet_symmetry_forbidden_I1, janev_triplet_A3, janev_triplet_B3,
// janev_triplet_C3, janev_triplet_D3, janev_triplet_E3, janev_vibrational_first, janev_vibrational_second,
// england_rotational_j0_to_j2, england_rotational_j1_to_j3
double buildExcitationEnergy(std::string excitation_state);
// return the function for a predefined excitation cross section (see simulation/cross_sections.h)
// defined by the string "excitation_state"
// possible values for the excitation_state are:
// - janev_singlet_B1, janev_singlet_B1prime, janev_singlet_B1primeprime, janev_singlet_C1, janev_singlet_D1,
// janev_singlet_D1prime, janev_singlet_symmetry_forbidden_EF1, janev_singlet_symmetry_forbidden_HHb,
// janev_singlet_symmetry_forbidden_GK1, janev_singlet_symmetry_forbidden_I1, janev_triplet_A3, janev_triplet_B3,
// janev_triplet_C3, janev_triplet_D3, janev_triplet_E3, janev_vibrational_first, janev_vibrational_second,
// england_rotational_j0_to_j2, england_rotational_j1_to_j3
std::function<double(double)> buildExcitationCrossSection(
std::string excitation_state);
// if the string target_name is used as a key in either the map for the TrackedSpecies or
// the map for the BackgroundSpecies returns the corresponding Species
// (the keys in the map are defined by the name given in the json parameter file)
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);
// if the string target_name is used as a key in either the map for the TrackedSpecies
// returns the corresponding TrackedSpecie
// (the keys in the map are defined by the name given in the json parameter file)
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 */