ParMooN
 All Classes Functions Variables Friends Pages
SinCos1.h
1 // ======================================================================
2 // instationary problem
3 // ======================================================================
4 
5 #define __SINCOS1__
6 
8 // example file
9 // ========================================================================
10 
11 void ExampleFile()
12 {
13  OutPut("Example: SinCos1.h" << endl);
14  TDatabase::ParamDB->INTERNAL_STEADY_STATE_MATRICES_OR_RHS = 0;
15 }
16 // exact solution
17 void Exact(double x, double y, double *values)
18 {
19  double t;
20 
21  t = TDatabase::TimeDB->CURRENTTIME;
22 
23  values[0] = sin(t*t)*cos(x*y*y);
24  values[1] = -sin(t*t)*sin(x*y*y)*y*y;
25  values[2] = -sin(t*t)*sin(x*y*y)*2*x*y;
26  values[3] = 0;
27 }
28 
29 // kind of boundary condition (for FE space needed)
30 void BoundCondition(int BdComp, double t, BoundCond &cond)
31 {
32  if (TDatabase::ParamDB->SOLD_PARAMETER_TYPE == FEM_FCT)
33  cond = NEUMANN;
34  else
35  cond = DIRICHLET;
36 }
37 
38 // value of boundary condition
39 void BoundValue(int BdComp, double Param, double &value)
40 {
41  double t;
42 
43  t = TDatabase::TimeDB->CURRENTTIME;
44  switch(BdComp)
45  {
46  case 0: value = sin(t*t);
47  break;
48  case 1: value = sin(t*t)*cos(Param*Param);
49  break;
50  case 2: value = sin(t*t)*cos(1-Param);
51  break;
52  case 3: value = sin(t*t);
53  break;
54  }
55 }
56 
57 // initial conditon
58 void InitialCondition(double x, double y, double *values)
59 {
60  double t;
61 
62  t = TDatabase::TimeDB->CURRENTTIME;
63 
64  values[0] = sin(t*t)*cos(x*y*y);
65 }
66 
67 void BilinearCoeffs(int n_points, double *X, double *Y,
68  double **parameters, double **coeffs)
69 {
70  double eps=1./TDatabase::ParamDB->PE_NR;
71  double b1=2., b2=-1., c=1.;
72  int i;
73  double *coeff, *param;
74  double x, y;
75  double t = TDatabase::TimeDB->CURRENTTIME;
76  double tau = TDatabase::TimeDB->CURRENTTIMESTEPLENGTH;
77 
78  // previous discrete time
79  tau = t-tau;
80 
81  for(i=0;i<n_points;i++)
82  {
83  coeff = coeffs[i];
84  param = parameters[i];
85 
86  x = X[i];
87  y = Y[i];
88 
89  coeff[0] = eps;
90  coeff[1] = b1;
91  coeff[2] = b2;
92  coeff[3] = c;
93 
94  coeff[4] = cos(t*t)*2*t*cos(x*y*y)
95  - eps* sin(t*t)*(-cos(x*y*y)*(y*y*y*y+4*x*x*y*y) - sin(x*y*y)*2*x)
96  - b1*sin(t*t)*sin(x*y*y)*y*y - b2*sin(t*t)*sin(x*y*y)*2*x*y
97  + c*sin(t*t)*cos(x*y*y);
98  // rhs from previous time step
99  coeff[5] = cos(tau*tau)*2*tau*cos(x*y*y)
100  - eps* sin(tau*tau)*(-cos(x*y*y)*(y*y*y*y+4*x*x*y*y) - sin(x*y*y)*2*x)
101  - b1*sin(tau*tau)*sin(x*y*y)*y*y - b2*sin(tau*tau)*sin(x*y*y)*2*x*y
102  + c*sin(tau*tau)*cos(x*y*y);
103  }
104 }
static TTimeDB * TimeDB
Definition: Database.h:1137
static TParamDB * ParamDB
Definition: Database.h:1134