My Project
PSD.h
1 
13 #ifndef PhaseSpaceDensity_H
14 #define PhaseSpaceDensity_H
17 
18 // General C++ headers
19 #include <fstream>
20 #include <string>
21 // Type of data (it could be deptecated)
22 #include <map>
23 
24 // Operations with Grig array
25 #include "../Grid/Grid.h"
26 // Operations with matrixes
27 #include "../Matrix/Matrix.h"
28 // Operations with coefficients
29 #include "../DiffusionCoefficient/DiffusionCoefficient.h"
30 // Pfrfmeters from ini file
31 #include "../Parameters/Parameters.h"
32 // Equation solver (main algoritm)
33 #include "MatrixSolver.h"
34 
35 // class to operate by sources and losses processes
36 #include "../Grid/AdditionalSourcesAndLosses.h"
37 
38 
39 using namespace std;
40 
41 
48 class PSD {
49 public:
50 
51 
54 
57 
65  void Create_Initial_PSD(Parameters_structure::PSD parameters, Grid &grid, BoundaryCondition L_UpperBoundaryCondition);
66 
77  void Interpolate(PSD &otherPSD, Parameters_structure::Interpolation interpolationParameters, Grid &oldGrid, Grid &newGrid, Matrix2D<double> newGrid_pc_lowerBoundaryCondition, Matrix2D<double> newGrid_pc_upperBoundaryCondition);
78 
93  void Load_initial_f(GridElement &L, GridElement &pc, GridElement &alpha, double tau, double Kp, double min_psd = 1.e-99, string J_L7_function = "J_L7", double fb_out = 1, double fb_in = 0);
94 
106  void Load_initial_f_two_zone(GridElement &L, GridElement &pc, GridElement &alpha, double tau, double tauLpp, double Kp, double min_psd = 1.e-99, string J_L7_function = "J_L7", double fb_out = 1, double fb_in = 0);
107 
108 
123  void Load_initial_f_from_outer_L(GridElement &L, GridElement &pc, GridElement &alpha, double tau, double Kp, Matrix2D<double> L_UpperBoundaryCondition, double min_psd = 1.e-99, double fb_out = 1, double fb_in = 0);
124 
125 
126  void Load_initial_f_2d(GridElement &L, GridElement &pc, GridElement &alpha, const char *filename);
127 
128 
129  void Load_initial_f_file(GridElement &L, GridElement &pc, GridElement &alpha, const char *filename, bool with_grid);
130 
131 
132  void Load_initial_f_maxwell(GridElement &L, GridElement &pc, GridElement &alpha);
133 
134  // Explicit mixed terms
135  void DiffusionMixTermExplicit(double dt, double Lpp,
137  GridElement &L, GridElement &pc, GridElement &alpha, Matrix3D<double> Jacobian,
138  Matrix2D<double> pc_lowerBoundaryCondition,
139  Matrix2D<double> pc_upperBoundaryCondition,
140  Matrix2D<double> alpha_lowerBoundaryCondition,
141  Matrix2D<double> alpha_upperBoundaryCondition,
142  string pc_lowerBoundaryCondition_calculationType,
143  string pc_upperBoundaryCondition_calculationType,
144  string alpha_lowerBoundaryCondition_calculationType,
145  string alpha_upperBoundaryCondition_calculationType);
146 
147 
148  void Diffusion_alpha(double dt, double Lpp,
150  GridElement &L, GridElement &pc, GridElement &alpha, Matrix3D<double> Jacobian,
151  Matrix2D<double> alpha_lowerBoundaryCondition,
152  Matrix2D<double> alpha_upperBoundaryCondition,
153  string alpha_lowerBoundaryCondition_calculationType,
154  string alpha_upperBoundaryCondition_calculationType);
155 
156  void Diffusion_pc(double dt, double Lpp,
157  DiffusionCoefficient &Dpcpc, DiffusionCoefficient &DpcpcLpp,
158  GridElement &L, GridElement &pc, GridElement &alpha, Matrix3D<double> Jacobian,
159  Matrix2D<double> pc_lowerBoundaryCondition,
160  Matrix2D<double> pc_upperBoundaryCondition,
161  string pc_lowerBoundaryCondition_calculationType,
162  string pc_upperBoundaryCondition_calculationType);
163 
164  void Diffusion_L(double dt, double Lpp,
166  GridElement &L, GridElement &pc, GridElement &alpha, Matrix3D<double> Jacobian,
167  Matrix2D<double> lowerBoundaryCondition,
168  Matrix2D<double> upperBoundaryCondition,
169  string lowerBoundaryCondition_calculationType,
170  string upperBoundaryCondition_calculationType,
171  double tau, double tauLpp);
172 
173 
174  void Diffusion_pc_alpha(double dt, double Lpp,
175  DiffusionCoefficient &Dpcpc, DiffusionCoefficient &DpcpcLpp,
178  GridElement &L, GridElement &pc, GridElement &alpha, Matrix3D<double> Jacobian,
179  Matrix2D<double> pc_lowerBoundaryCondition,
180  Matrix2D<double> pc_upperBoundaryCondition,
181  Matrix2D<double> alpha_lowerBoundaryCondition,
182  Matrix2D<double> alpha_upperBoundaryCondition,
183  string pc_lowerBoundaryCondition_calculationType,
184  string pc_upperBoundaryCondition_calculationType,
185  string alpha_lowerBoundaryCondition_calculationType,
186  string alpha_upperBoundaryCondition_calculationType);
187 
188  void Diffusion_pc_alpha_KC(double dt, double Lpp,
189  DiffusionCoefficient &Dpcpc, DiffusionCoefficient &DpcpcLpp,
192  GridElement &L, GridElement &pc, GridElement &alpha, Matrix3D<double> Jacobian,
193  Matrix2D<double> pc_lowerBoundaryCondition,
194  Matrix2D<double> pc_upperBoundaryCondition,
195  Matrix2D<double> alpha_lowerBoundaryCondition,
196  Matrix2D<double> alpha_upperBoundaryCondition,
197  string pc_lowerBoundaryCondition_calculationType,
198  string pc_upperBoundaryCondition_calculationType,
199  string alpha_lowerBoundaryCondition_calculationType,
200  string alpha_upperBoundaryCondition_calculationType);
201 
202  CalculationMatrix matr_A, matr_B, matr_C;
203 
204 
206  //void ScaleBoundaryFlux(Parameters_structure::PSD parameters, GridElement &L, GridElement &pc, GridElement &alpha);
208 
209  void SourcesAndLosses(
210  Parameters_structure parameters,
211  GridElement &L, GridElement &pc, GridElement &alpha,
213  double dt,
214  double Lpp, double tau, double tauLpp, double Kp);
215 
216  // output functions
217  void Output_without_grid(double time);
218  ofstream output_without_grid_file;
219 
220 };
221 
224 void steady_state(Matrix1D<double> &f, double tau, double Kp, int nx, Matrix1D<double> &CL, double f_bnd_out = 1, double f_bnd_in = 0);
225 // kckim
226 void steady_state_two_zone(Matrix1D<double> &f, Matrix1D<double> &tau, double Kp, double alpha, Matrix1D<double> &Ke, int nx, Matrix1D<double> &CL, double f_bnd_out = 1, double f_bnd_in = 0);
227 //
228 
229 #endif
230 
Interpolation parameters structure
Definition: Parameters.h:238
Array of values of coordinate axes.
Definition: Grid.h:28
Calculates any additional sources and losses due to magnetopause.
Definition: AdditionalSourcesAndLosses.h:23
Holds diffusion coefficient matrix and routines to load and calculate it.
Definition: DiffusionCoefficient.h:23
General namespace.
This matrix calculates the diagonal values and index given parameters for x, y, and z...
Definition: Matrix.h:310
Main parameters structure that holds smaller structures for individual parameters.
Definition: Parameters.h:87
Parameters_structure::PSD PSD_parameters
Parameters from ini file.
Definition: PSD.h:56
Phase Space Density class.
Definition: PSD.h:48
Holds upper and lower boundary conditions.
Definition: BoundaryConditions.h:26
Matrix3D< double > arr
array of PSD values
Definition: PSD.h:53
Computational grid composed of 3 different GridElement.
Definition: Grid.h:53
PSD parameters structure.
Definition: Parameters.h:178