ParMooN
 All Classes Functions Variables Friends Pages
Obstacle.h
1 // Bechmark for Darcy problem, exact solution of the flux is linear
2 //
3 
4 void ExampleFile()
5 {
6  OutPut("Example: Obstacle.h.\nThe obstacle is 10 times less conductive " <<
7  "and has the shape of\n ");
8  switch((int)TDatabase::ParamDB->P0)
9  {
10  case 0:
11  OutPut("a circle in the center\n");
12  break;
13  case 1:
14  OutPut("a square in the center\n");
15  break;
16  case 2:
17  OutPut("a diamond in the center\n");
18  break;
19  case 3:
20  OutPut("two boxes on one vertical line, one at the top, the other "<<
21  "at the bottom\n");
22  break;
23  case 4:
24  OutPut("two half circles on one vertical line, one at the top, " <<
25  "one at the bottom\n");
26  break;
27  case 5:
28  OutPut("two boxes with a vertical offset, on at the top, one at " <<
29  "the bottom\n");
30  break;
31  case 6:
32  OutPut("two half ellipsoids with a vertical offset, on at the top, " <<
33  "one at the bottom\n");
34  break;
35  case 7:
36  OutPut("hump in the center (continuous change in permeability)\n");
37  break;
38  default:
39  ErrMsg("Unknown obstacle. Set P0 in the input file to 0,...,7\n");
40  exit(0);
41  break;
42  }
43  TDatabase::ParamDB->INTERNAL_PROJECT_PRESSURE = 1;
44 }
45 
46 // ========================================================================
47 // multi indices used for various things
48 // ========================================================================
49 // no exact solution known
50 void ExactU1(double x, double y, double *values)
51 {
52  values[0] = 0.0;
53  values[1] = 0.0;
54  values[2] = 0.0;
55  values[3] = 0.0;
56 }
57 
58 void ExactU2(double x, double y, double *values)
59 {
60  values[0] = 0.0;
61  values[1] = 0.0;
62  values[2] = 0.0;
63  values[3] = 0.0;
64 }
65 
66 void ExactP(double x, double y, double *values)
67 {
68  values[0] = 0.0;
69  values[1] = 0.0;
70  values[2] = 0.0;
71  values[3] = 0.0;
72 }
73 
74 // ========================================================================
75 // boundary conditions
76 // ========================================================================
77 void BoundCondition(int bdComp, double t, BoundCond &cond)
78 {
79  cond = DIRICHLET;
80 }
81 
82 // u \cdot n
83 void FluxBoundValue(int bdComp, double Param, double &value)
84 {
85  switch(bdComp)
86  {
87  case 0:
88  value = 0.0;
89  break;
90  case 1:
91  value = 1.0;
92  break;
93  case 2:
94  value = 0.0;
95  break;
96  case 3:
97  value = -1.0;
98  break;
99  default: cout << "wrong boundary part number" << endl;
100  break;
101  }
102 }
103 
104 // ========================================================================
105 // coefficient and right hand side
106 // ========================================================================
107 void LinCoeffs(int n_points, double *X, double *Y,
108  double **parameters, double **coeffs)
109 {
110  static double eps = 1.0/TDatabase::ParamDB->SIGMA_PERM;
111  double *coeff;
112  double x,y;
113  double r;
114 
115  // choose different obstacles:
116  // 0 - circle in center
117  // 1 - square in center
118  // 2 - diamond in center
119  // 3 - two boxes, one at the top, one at the bottom
120  // 4 - two half circles, one at the top, one at the bottom
121  // 5 - two boxes, one at the top, one at the bottom, boxes have an offset
122  // 6 - two half ellipsoids with an offset, one at the top, one at the bottom,
123  // 7 - continuous change in permeability in form of a hump
124  int obstacle = TDatabase::ParamDB->P0;
125  // inside the obstacle the porousity sigma is multiplied by factor
126  double factor = 10;
127 
128  for(int i = 0; i < n_points; i++)
129  {
130  coeff = coeffs[i];
131 
132  x = X[i];
133  y = Y[i];
134 
135  coeff[0] = eps;
136  switch (obstacle)
137  {
138  case 0:
139  r = sqrt((x-0.5)*(x-0.5)+(y-0.5)*(y-0.5));
140  if( r < 0.2 )
141  coeff[0] *= factor;
142  break;
143  case 1:
144  if( x>0.45 && x<0.55 && y>0.35 && y<0.65)
145  coeff[0] *= factor;
146  break;
147  case 2:
148  if (x+y>0.8 && x+y<1.2 && x-y<0.2 && x-y>-0.2)
149  coeff[0] *= factor;
150  break;
151  case 3:
152  if(x>0.35 && x<0.65 && (y<0.2 || y>0.8))
153  coeff[0] *= factor;
154  break;
155  case 4:
156  r = sqrt((x-0.5)*(x-0.5)+y*y);
157  if( r < 0.2 )
158  coeff[0] *= factor;
159  r = sqrt((x-0.5)*(x-0.5)+(y-1)*(y-1));
160  if( r < 0.2 )
161  coeff[0] *= factor;
162  break;
163  case 5:
164  if((x>0.65 && x<0.75 && y<0.6) || (x>0.25 && x<0.35 && y>0.4))
165  coeff[0] *= factor;
166  break;
167  case 6:
168  r = sqrt((x-0.75)*(x-0.75)+0.1*y*y);
169  if( r < 0.2 )
170  coeff[0] *= factor;
171  r = sqrt((x-0.25)*(x-0.25)+0.1*(y-1)*(y-1));
172  if( r < 0.2 )
173  coeff[0] *= factor;
174  break;
175  case 7:
176  r = sqrt((x-0.5)*(x-0.5)+(y-0.5)*(y-0.5));
177  if( r < 0.2 )
178  coeff[0] *= 1+0.5*factor*(cos(5*Pi*r)+1);
179  break;
180  }
181 
182  coeff[1] = 0; // f1
183  coeff[2] = 0; // f2
184  coeff[3] = 0; // g
185  }
186 }
double P0
Definition: Database.h:533
static TParamDB * ParamDB
Definition: Database.h:1134