Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
ComponentComsol.hh
Go to the documentation of this file.
1#pragma once
2
4
5namespace Garfield {
6
7/// Component for importing and interpolating Comsol field maps.
8
10 public:
11 /// Default constructor.
13 /// Constructor from file names.
14 ComponentComsol(const std::string& mesh, const std::string& mplist,
15 const std::string& field, const std::string& unit = "m");
16 /// Destructor.
18
19 void ElectricField(const double x, const double y, const double z, double& ex,
20 double& ey, double& ez, Medium*& m, int& status) override;
21 void ElectricField(const double x, const double y, const double z, double& ex,
22 double& ey, double& ez, double& v, Medium*& m,
23 int& status) override;
24
25 void WeightingField(const double x, const double y, const double z,
26 double& wx, double& wy, double& wz,
27 const std::string& label) override;
28
29 double WeightingPotential(const double x, const double y, const double z,
30 const std::string& label) override;
31 double DelayedWeightingPotential(const double x, const double y,
32 const double z, const double t,
33 const std::string& label) override;
34
35 Medium* GetMedium(const double x, const double y, const double z) override;
36
37 /** Import a field map.
38 * \param header name of the file containing the list of nodes
39 * \param mplist name of the file containing the material properties
40 * \param field name of the file containing the potentials at the nodes
41 * \param unit length unit
42 */
43 bool Initialise(const std::string& header = "mesh.mphtxt",
44 const std::string& mplist = "dielectrics.dat",
45 const std::string& field = "field.txt",
46 const std::string& unit = "m");
47 /// Import the time-independent weighting field maps.
48 bool SetWeightingField(const std::string& file, const std::string& label);
49 /// Import the time-dependent weighting field maps.
50 bool SetDelayedWeightingPotential(const std::string& file,
51 const std::string& label);
52 /// Set the time interval of the time-dependent weighting field.
53 void SetTimeInterval(const double mint, const double maxt,
54 const double stept);
55
56 protected:
58
59 double GetElementVolume(const unsigned int i) override;
60 void GetAspectRatio(const unsigned int i, double& dmin,
61 double& dmax) override;
62
63 private:
64 double m_unit = 100.;
65 bool m_timeset = false;
66
67 bool GetTimeInterval(const std::string& file);
68};
69} // namespace Garfield
Component for importing and interpolating Comsol field maps.
bool SetDelayedWeightingPotential(const std::string &file, const std::string &label)
Import the time-dependent weighting field maps.
void UpdatePeriodicity() override
Verify periodicities.
void SetTimeInterval(const double mint, const double maxt, const double stept)
Set the time interval of the time-dependent weighting field.
bool Initialise(const std::string &header="mesh.mphtxt", const std::string &mplist="dielectrics.dat", const std::string &field="field.txt", const std::string &unit="m")
Medium * GetMedium(const double x, const double y, const double z) override
Get the medium at a given location (x, y, z).
void WeightingField(const double x, const double y, const double z, double &wx, double &wy, double &wz, const std::string &label) override
bool SetWeightingField(const std::string &file, const std::string &label)
Import the time-independent weighting field maps.
double WeightingPotential(const double x, const double y, const double z, const std::string &label) override
double DelayedWeightingPotential(const double x, const double y, const double z, const double t, const std::string &label) override
ComponentComsol()
Default constructor.
void ElectricField(const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status) override
double GetElementVolume(const unsigned int i) override
void GetAspectRatio(const unsigned int i, double &dmin, double &dmax) override
Base class for components based on finite-element field maps.
Abstract base class for media.
Definition: Medium.hh:13