ParMooN
 All Classes Functions Variables Friends Pages
ConstT.h
1 // ==========================================================================
2 // instationary problem
3 // ==========================================================================
4 
5 //===========================================================================
6 // example file
7 // =========================================================================
8 // Chang et al., Numerical Heat Transfer, Part B vol 19, pp. 69-84, 1991
9 // exact solution for constant wall temperature for parallelepiped
10 void ExampleFile()
11 {
12  OutPut("Example: ConstT.h" << endl);
13 }
14 
15 // exact solution
16 void Exact(double x, double y, double z, double *values)
17 {
18  double t, T_int;
19  double PI =3.14159265;
20 
21 // x = 2.*x-1.;
22 // y = 2.*y-1.;
23 // z = 2.*z-1.;
24 
25  T_int =1.;
26  t = TDatabase::TimeDB->CURRENTTIME;
27 
28  values[0] = (64.*T_int/(PI*PI*PI))*(exp(-3.*PI*PI*t/4.))*cos(PI*x/2.)*cos(PI*y/2.)*cos(PI*z/2.);
29  values[1] = 0;
30  values[2] = 0;
31  values[3] = 0;
32  values[4] = 0;
33 
34 }
35 
36 // void Exact(double x, double y, double z, double *values)
37 // {
38 // int i, j, k, N;
39 // double t, a, s, T, T_int, T_w, temp;
40 // double m, n, l;
41 // double PI =3.14159265;
42 //
43 // x = 2.*x-1.;
44 // y = 2.*y-1.;
45 // z = 2.*z-1.;
46 //
47 // N= 20;
48 // t = TDatabase::TimeDB->CURRENTTIME;
49 //
50 // a = 0.;
51 // T_int =1.;
52 // T_w = 2.;
53 //
54 // x = 0.5;
55 // y = 0;
56 // z = 0;
57 // s = T_w;
58 // for(i=1;i<N;i++)
59 // for(j=1;j<N;j++)
60 // for(k=1;k<N;k++)
61 // {
62 // m = (double)i;
63 // n = (double)j;
64 // l = (double)k;
65 // a =(64.*(T_int - T_w)/(PI*PI*PI*(2.*m-1.)*(2.*n-1.)*(2.*l-1.)))*sin((2.*m-1.)*PI/2.)*sin((2.*n-1.)*PI/2.)*sin((2.*l-1.)*PI/2.);
66 // temp = ((2.*m-1.)*PI/2.)*((2.*m-1.)*PI/2.) + ((2.*n-1.)*PI/2.)*((2.*n-1.)*PI/2.) + ((2.*l-1.)*PI/2.)*((2.*l-1.)*PI/2.);
67 // s += a*(exp(-temp*t))*cos((2.*m-1.)*PI*x/2.)*cos((2.*n-1.)*PI*y/2.)*cos((2.*l-1.)*PI*z/2.) ;
68 // }
69 //
70 // values[0] = s;
71 // values[1] = 0;
72 // values[2] = 0;
73 // values[3] = 0;
74 // values[4] = 0;
75 // }
76 
77 // initial conditon
78 void InitialCondition(double x, double y, double z, double *values)
79 {
80  double t, T_int;
81  double PI =3.14159265;
82 
83 // x = 2.*x-1.;
84 // y = 2.*y-1.;
85 // z = 2.*z-1.;
86 
87  T_int =1.;
88  t =0.;
89 
90  values[0] = (64.*T_int/(PI*PI*PI))*(exp(-3.*PI*PI*t/4.))*cos(PI*x/2.)*cos(PI*y/2.)*cos(PI*z/2.);
91 }
92 
93 // void InitialCondition(double x, double y, double z, double *values)
94 // {
95 // int i, j, k, N;
96 // double t, a, s, T, T_int, T_w, temp;
97 // double m, n, l;
98 // double PI =3.14159265;
99 //
100 // x = 2.*x-1.;
101 // y = 2.*y-1.;
102 // z = 2.*z-1.;
103 //
104 // N= 20;
105 // t = 0.;
106 //
107 // a = 0.;
108 // T_int =1.;
109 // T_w = 2.;
110 //
111 // x = 0.5;
112 // y = 0;
113 // z = 0;
114 // s = T_w;
115 // for(i=1;i<N;i++)
116 // for(j=1;j<N;j++)
117 // for(k=1;k<N;k++)
118 // {
119 // m = (double)i;
120 // n = (double)j;
121 // l = (double)k;
122 // a =(64.*(T_int - T_w)/(PI*PI*PI*(2.*m-1.)*(2.*n-1.)*(2.*l-1.)))*sin((2.*m-1.)*PI/2.)*sin((2.*n-1.)*PI/2.)*sin((2.*l-1.)*PI/2.);
123 // temp = ((2.*m-1.)*PI/2.)*((2.*m-1.)*PI/2.) + ((2.*n-1.)*PI/2.)*((2.*n-1.)*PI/2.) + ((2.*l-1.)*PI/2.)*((2.*l-1.)*PI/2.);
124 // s += a*(exp(-temp*t))*cos((2.*m-1.)*PI*x/2.)*cos((2.*n-1.)*PI*y/2.)*cos((2.*l-1.)*PI*z/2.) ;
125 // }
126 //
127 // values[0] = s;
128 // }
129 //
130 //
131 
132 
133 // kind of boundary condition
134 void BoundCondition(double x, double y, double z, BoundCond &cond)
135 {
136  cond = DIRICHLET;
137 }
138 
139 // value of boundary condition
140 void BoundValue(double x, double y, double z, double &value)
141 {
142  value = 0;
143 }
144 
145 void BilinearCoeffs(int n_points, double *X, double *Y, double *Z,
146  double **parameters, double **coeffs)
147 {
148  double eps = 1.0/TDatabase::ParamDB->RE_NR;
149  int i;
150  double *coeff; // *param;
151  double x, y, z, c, a[3], b[3], s[3], h;
152  double t = TDatabase::TimeDB->CURRENTTIME;
153 
154  b[0] = 0;
155  b[1] = 0;
156  b[2] = 0;
157  c = 0;
158 
159  for(i=0;i<n_points;i++)
160  {
161  coeff = coeffs[i];
162  // param = parameters[i];
163 
164  x = X[i];
165  y = Y[i];
166  z = Z[i];
167 
168  // diffusion
169  coeff[0] = eps;
170  // convection in x direction
171  coeff[1] = b[0];
172  // convection in y direction
173  coeff[2] = b[1];
174  // convection in z direction
175  coeff[3] = b[2];
176  // reaction
177  coeff[4] = c;
178  // rhs
179  coeff[5] = 0;
180  coeff[6] = 0;
181  }
182 }
183 
static TTimeDB * TimeDB
Definition: Database.h:1137
double RE_NR
Definition: Database.h:313
static TParamDB * ParamDB
Definition: Database.h:1134