VERB_code_2.2  2
 All Classes Namespaces Files Functions Variables Typedefs Macros Pages
Grid.h
Go to the documentation of this file.
1 /**
2  * \file Grid.h
3  * Grids, grid elements and boundary conditions headers.
4  *
5  * \author Developed under supervision of the PI Yuri Shprits
6  */
7 
8 #ifndef Grid_H
9 #define Grid_H
10 
11 #include <string>
12 #include "../Matrix/Matrix.h"
13 #include "../Parameters/Parameters.h"
14 #include "../VariousFunctions/variousFunctions.h"
15 #include "Grid.h"
16 #include "BoundaryConditions.h"
17 
18 using namespace std;
19 
20 
21 /**
22  * Array of values of coordinate axe.
23  *
24  * Class for %GridElement in parent class Matrix3D holds values of one coordinate from 3-dimentional (usually) coordinate system.
25  * Has two BoundaryCondition members: lowerBoundaryCondition and upperBoundaryCondition.
26  * Has functions to create girds of different type.
27  */
28 class GridElement {
29 public:
30  Matrix3D<double> arr; // array of grid points
31 
32  // initialized flag
34 
35  // parameters
37 
38  // members
39  int size;
40 
41  // other functions
42  //GridElement Kfunc(); // return NEW Grid Element equal to Kfunc of present
43  void Kfunc_equal(GridElement arg); // make THIS element equal to Kfunc(arg). Preferred to use this one, works faster
44  void SetRegularGridValue(int il, int im, int ia, int gridElementDirection); // return value for specified parameters for regular grid
45 };
46 
47 
48 /**
49  * Computational grid
50  * Combined from 3 grid elements: L, pc, Alpha and additional array of epc values for convenience.
51  */
52 class Grid {
53 private:
54 public:
55  // members
56  GridElement L, pc, alpha, epc;
57  //Matrix3D<double> L, pc, alpha, epc;
58  //int LSize, pcSize, alphaSize, epcSize;
59 
60  string type;
62 
63  void Create_Grid(Parameters_structure::GridElement parameters_L,
65  Parameters_structure::GridElement parameters_alpha,
66  Parameters_structure::GridElement parameters_epc,
67  string grid_filename, string gridType,
68  Grid SecondGrid = Grid()); // the last parameter is needed in case we create the grid based on another grid
69 
70  void Output(string filename);
71 
72  /** Jacobian of the diffusion equation.
73  * In 1d_universal_solver there is a parameter 'n' represented power of variable in the equation
74  * \f$ x^n \frac{\partial}{\partial x} x^{-n} D_{xx} \frac{\partial f}{\partial x} \f$.
75  * More general case is using Jacobian:
76  * \f$ Jacobian \frac{\partial}{\partial x} Jacobian^{-1} D_{xx} \frac{\partial f}{\partial x} \f$.
77  */
79 
80 };
81 
82 /** Root finding function, used in grid construction.
83  */
84 double find_alpha(double RHS, double alpha_min, double alhpa_max, double ERR = 1e-12, int max_it = 100, int it = 0);
85 
86 #endif