criptic v1
Cosmic Ray Interstellar Propagation Tool using Itô Calculus
Loading...
Searching...
No Matches
GizmoGas.H
Go to the documentation of this file.
1
7#include <iostream>
8#include <vector>
9#include <string>
10#include "../Definitions.H"
11#include "../Core/FieldQty.H"
12#include "../MPI/MPIUtil.H"
13#include "../Utils/Constants.H"
14#include "../Utils/Units.H"
15#include "../Core/CRTree.H"
16#include "../Losses/Losses.H"
17#include "../Prob/Prob.H"
18#include "../Propagation/Propagation.H"
19#include "../Utils/Types.H"
20#include "../Gas/Gas.H"
21#include "GasTree.H"
22#include "hdf5.h"
23
24#ifndef _GIZMOGAS_H_
25#define _GIZMOGAS_H_
26
27namespace criptic {
37
38 public:
43 GizmoReader(std::string filename);
44
54 template <typename T>
55 static void giveUnits(std::vector<T>& unscaled, Real unit) {
56 IdxType len = unscaled.size();
57 for (IdxType i = 0; i<len; i++) {
58 unscaled[i] *= unit;
59 }
60 }
61
63 // Internal Data
65
66 std::string file;
67 std::vector<double> smooth;
68 std::vector<double> density;
69 std::vector<double> ionDensity;
70 // Element abundances except metals are all fractions compared to all hydrogen
71 std::vector<double> hIfrac;
72 std::vector<double> hIIfrac;
73 std::vector<double> heIfrac;
74 std::vector<double> heIIfrac;
75 std::vector<double> heIIIfrac;
76 std::vector<double> elAbundance;
77 std::vector<double> metals;
78 std::vector<RealVec> velocity;
79 std::vector<RealVec> position;
80 std::vector<RealVec> magField;
81 };
82
83 namespace gas{
92 class GizmoGas : public Gas {
93 public:
95 // CONSTRUCTORS & DESTRUCTORS
97
108 GizmoGas(std::string filename, Real hLimit = 0, int leafSize_ = 32);
109
123 GizmoGas(const ParmParser& pp,
124 const Geometry& geom_,
125 const IdxType nBB,
126 const int nGhost);
127
132 delete data;
133 delete particleTree;
134 }
136 // Important functions for loading data
138
145 virtual GasData gasData(const RealVec &x, const Real t) const override;
146
157 static GizmoGas* loadData(const std::string filename,
158 Real hLimit=0, int leafSize = 32) {
159 return new GizmoGas(filename, hLimit, leafSize);
160 };
172 static GizmoGas* loadData(const std::string filename,
173 const ParmParser& pp, const Geometry& geom_,
174 const IdxType nBB_, const int nGhost_ = 1) {
175 Real hMax = 0;
176 int lSize = 32;
177 int verbosity = 1;
178 pp.get("verbosity", verbosity);
179 pp.get("gas.tree.maxH", hMax);
180 pp.get("gas.tree.leafSize", lSize);
181 if (verbosity > 1 && MPIUtil::IOProc){
182 std::cout << "GizmoGas: reading " << filename.c_str() << std::endl;
183 }
184 return GizmoGas::loadData(filename, hMax, lSize);
185 };
186
191 static Real loadTime(std::string filename);
192
194 // Internal data
196 private:
197 std::string filename;
203 };
204 }
205}
206
207//_GIZMOGAS_H_
208#endif
Class to create 3d trees for gas particles.
A class to manage Gas packets for Lagrangian gas descriptions.
Definition GasTree.H:75
A class that describes the geometry of a calculation.
Definition Geometry.H:32
A class to hold all relevant data from a GIZMO snapshot file.
Definition GizmoGas.H:36
std::vector< double > hIfrac
Definition GizmoGas.H:71
std::vector< RealVec > velocity
Definition GizmoGas.H:78
std::vector< double > heIIfrac
Definition GizmoGas.H:74
std::vector< double > density
Definition GizmoGas.H:68
std::vector< double > heIIIfrac
Definition GizmoGas.H:75
static void giveUnits(std::vector< T > &unscaled, Real unit)
Multiply all elements of a vector by a unit to scale.
Definition GizmoGas.H:55
std::vector< double > heIfrac
Definition GizmoGas.H:73
std::string file
Definition GizmoGas.H:66
std::vector< double > metals
Definition GizmoGas.H:77
std::vector< double > hIIfrac
Definition GizmoGas.H:72
std::vector< double > smooth
Definition GizmoGas.H:67
std::vector< RealVec > magField
Definition GizmoGas.H:80
std::vector< RealVec > position
Definition GizmoGas.H:79
std::vector< double > elAbundance
Definition GizmoGas.H:76
std::vector< double > ionDensity
Definition GizmoGas.H:69
Class to parse the criptic input deck.
Definition ParmParser.H:37
void get(const std::string &name, int &val) const
Return an integer-valued keyword.
Definition ParmParser.cpp:129
Trivial class to hold gas data.
Definition GasData.H:29
Interface class to describe background gas.
Definition Gas.H:44
Gas class derived from a GIZMO snapshot.
Definition GizmoGas.H:92
int verbosity
Definition GizmoGas.H:200
static GizmoGas * loadData(const std::string filename, Real hLimit=0, int leafSize=32)
Loads a GizmoGas object from just a filename.
Definition GizmoGas.H:157
static Real loadTime(std::string filename)
Loads the snapshot time of a snapshot.
Definition GizmoGas.cpp:242
Real hLim
Definition GizmoGas.H:198
~GizmoGas()
Destructor.
Definition GizmoGas.H:131
GasTree * particleTree
Definition GizmoGas.H:202
static GizmoGas * loadData(const std::string filename, const ParmParser &pp, const Geometry &geom_, const IdxType nBB_, const int nGhost_=1)
Loads a GizmoGas object with the input deck and a filename.
Definition GizmoGas.H:172
std::string filename
Definition GizmoGas.H:197
virtual GasData gasData(const RealVec &x, const Real t) const override
Returns a gasData object describing the gas at the input point.
Definition GizmoGas.cpp:258
GizmoReader * data
Definition GizmoGas.H:201
int leafSize
Definition GizmoGas.H:199
bool IOProc
Definition MPIUtil.cpp:18
The primary namespace for criptic objects.
Definition AdvancePacket.H:25
std::vector< Real >::size_type IdxType
Definition Types.H:45
double Real
Definition Types.H:38