proteus  1.8.1
C/C++/Fortran libraries
analyticalSolutions.c
Go to the documentation of this file.
1 //
2 // analytical functions
3 //
4 #include "analyticalSolutions.h"
5 
36 int PlaneCouetteFlow_u(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
37 {
38 /*
39  Couette Flow between two parallel plates. One moving relative to the other with constant seperation (width).
40  Flow is axial. u != 0, v = w = 0 [Plates are very wide(z) and very long(x)]
41  vx = Velocity of moving plate in the x-dir.
42  h = width between plates in the y-dir.
43  Axis of orgin: bottom plate
44  xs,ys,zs = axis offset
45 
46  \del^2(\vecV) = 0
47 
48  d^2u/dy^2 = 0
49  u(y) =vx/h * Y
50 
51  u(0) = 0
52  u(h) = vx
53 */
54  int i;
55  double vx=rwork[0], h=rwork[1];
56  double ys=rwork[3];
57  double Y;
58 
59  for (i=0; i<nPoints; i++)
60  {
61  Y = x[i*3+1] - ys;
62 
63  u[i] = vx*(Y/h);
64  }
65 
66  return 0;
67 }
68 
84 int diffusionSin1D(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
85 {
86  int i;
87  double omega_x = iwork[0];
88 
89  for (i=0; i<nPoints; i++)
90  {
91  u[i] = -pow(2.0*PI*omega_x,2.0)*sin(2.0*PI*omega_x*x[i*3+0]);
92  }
93 
94  return 0;
95 }
111 int diffusionSin2D(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
112 {
113  int i;
114  double omega_x=iwork[0];
115  double omega_y=iwork[1];
116 
117  for (i=0; i<nPoints; i++)
118  {
119  u[i] = -pow(2.0*PI*omega_x,2.0)*sin(2.0*PI*omega_x*x[i*3+0])
120  -pow(2.0*PI*omega_y,2.0)*sin(2.0*PI*omega_y*x[i*3+1]) ;
121  }
122 
123  return 0;
124 }
141 int diffusionSin3D(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
142 {
143  int i;
144  double omega_x=2.0*PI*iwork[0];
145  double omega_y=2.0*PI*iwork[1];
146  double omega_z=2.0*PI*iwork[2];
147 
148  for (i=0; i<nPoints; i++)
149  {
150  u[i] = -pow(2.0*PI*omega_x,2.0)*sin(2.0*PI*omega_x*x[i*3+0])
151  -pow(2.0*PI*omega_y,2.0)*sin(2.0*PI*omega_y*x[i*3+1])
152  -pow(2.0*PI*omega_z,2.0)*sin(2.0*PI*omega_z*x[i*3+2]) ;
153  }
154 
155  return 0;
156 }
172 int diffusionSin1D_r(int *iwork, double *rwork, int nPoints, double t, double *x, double *u, double *r)
173 {
174  int i;
175  double omega_x=iwork[0];
176 
177  for (i=0; i<nPoints; i++)
178  {
179  r[i] = pow(2.0*PI*omega_x,2.0)*sin(2.0*PI*omega_x * x[i*3+0]);
180  }
181 
182  return 0;
183 }
200 int diffusionSin2D_r(int *iwork, double *rwork, int nPoints, double t, double *x, double *u, double *r)
201 {
202  int i;
203  double omega_x=iwork[0];
204  double omega_y=iwork[1];
205 
206  for (i=0; i<nPoints; i++)
207  {
208  r[i] = pow(2.0*PI*omega_x,2.0) * sin(2.0*PI*omega_x * x[i*3+0]) +
209  pow(2.0*PI*omega_y,2.0) * sin(2.0*PI*omega_y * x[i*3+1]) ;
210  }
211 
212  return 0;
213 }
231 int diffusionSin3D_r(int *iwork, double *rwork, int nPoints, double t, double *x, double *u, double *r)
232 {
233  int i;
234  double omega_x=iwork[0];
235  double omega_y=iwork[1];
236  double omega_z=iwork[2];
237 
238  for (i=0; i<nPoints; i++)
239  {
240  r[i] = pow(2.0*PI*omega_x,2.0) * sin(2.0*PI*omega_x * x[i*3+0]) +
241  pow(2.0*PI*omega_y,2.0) * sin(2.0*PI*omega_y * x[i*3+1]) +
242  pow(2.0*PI*omega_z,2.0) * sin(2.0*PI*omega_z * x[i*3+2]) ;
243  }
244 
245  return 0;
246 }
273 int LinearAD_DiracIC(int *iwork, double *rwork, int nPoints, double T, double *x, double *u)
274 /*
275  The exact solution of
276 
277  u_t + \deld(b u - a \grad u) = 0
278 
279  on an infinite domain with dirac initial data
280 
281  u0 = \int u0 \delta(x - x0)
282 
283  also returns advective, diffusive, and total flux
284 */
285 {
286  int i, j;
287  double b[3]={rwork[0],rwork[1],rwork[2]};
288  double n=rwork[3], a=rwork[4], tStart=rwork[5], u0=rwork[6];
289  double x0[3]={rwork[7],rwork[8],rwork[9]};
290  double y[3], exp_arg, yDoty, t = T + tStart;
291 
292  for (i=0; i<nPoints; i++)
293  {
294  for (yDoty=0.0,j=0; j<3; j++)
295  {
296  y[j] = x[i*3+j] - x0[j] - b[j]*t;
297  yDoty += y[j]*y[j];
298  }
299  exp_arg = yDoty / (4.0 * a * t) ;
300 
301  if (exp_arg > 100)
302  {
303  u[i] = 0.0;
304  }
305  else
306  {
307  u[i] = u0*exp(-exp_arg) / pow( (4.0*a*PI*t),(n/2.0) );
308  }
309  }
310 
311  return 0;
312 }
337 int LinearAD_DiracIC_advectiveVelocity(int *iwork, double *rwork, int nPoints, double T, double *x, double *f)
338 {
339  double b[3]={rwork[0],rwork[1],rwork[2]};
340  double *u = (double *)malloc(nPoints*sizeof(double));
341 
342  int i, j, iret;
343 
344  iret = LinearAD_DiracIC(iwork, rwork, nPoints, T, x, u);
345 
346  for (i=0; i<nPoints; i++)
347  {
348  for (j=0; j<3; j++)
349  {
350  f[i*3+j] = b[j]*u[i];
351  }
352  }
353  free(u);
354 
355  return iret;
356 }
381 int LinearAD_DiracIC_diffusiveVelocity(int *iwork, double *rwork, int nPoints, double T, double *x, double *f)
382 {
383  int i, j, iret;
384  double a=rwork[4];
385 
386  iret = LinearAD_DiracIC_du(iwork, rwork, nPoints, T, x, f);
387 
388  for (i=0; i<nPoints; i++)
389  {
390  for (j=0; j<3; j++)
391  {
392  f[i*3+j] = -a * f[i*3+j];
393  }
394  }
395  return iret;
396 }
423 int LinearAD_DiracIC_du(int *iwork, double *rwork, int nPoints, double T, double *x, double *f)
424 {
425  int i, j, iret;
426  double b[3]={rwork[0],rwork[1],rwork[2]};
427  double a=rwork[4], tStart=rwork[5];
428  double x0[3]={rwork[7],rwork[8],rwork[9]};
429  double y[3], t=T + tStart;
430  double *u = (double *)malloc(nPoints*sizeof(double));
431 
432  iret = LinearAD_DiracIC(iwork, rwork, nPoints, T, x, u);
433 
434  for (i=0; i<nPoints; i++)
435  {
436  for (j=0; j<3; j++)
437  {
438  y[j] = x[i*3+j] - x0[j] - b[j]*t;
439  f[i*3+j] = u[i]*2.0*y[j] / (4.0*a*t);
440  }
441  }
442  free(u);
443 
444  return iret;
445 }
446 
471 int LinearAD_DiracIC_totalVelocity(int *iwork, double *rwork, int nPoints, double T, double *x, double *f)
472 {
473  int i, j, iret;
474  double *f_adv = (double *)malloc(nPoints*3*sizeof(double));
475 
476  iret = LinearAD_DiracIC_advectiveVelocity(iwork, rwork, nPoints, T, x, f_adv);
477  iret += LinearAD_DiracIC_diffusiveVelocity(iwork, rwork, nPoints, T, x, f);
478 
479  for (i=0; i<nPoints; i++)
480  {
481  for (j=0; j<3; j++)
482  {
483  f[i*3+j] += f_adv[i*3+j];
484  }
485  }
486  free(f_adv);
487 
488  return iret;
489 }
508 int LinearAD_SteadyState(int *iwork, double *rwork, int nPoints, double t, double *X, double *u)
509 /*
510  The exact solution for
511  (bu - au_x)_x = 0
512  u(0) = 1
513  u(1) = 0
514 */
515 {
516  int i;
517  double b=rwork[0], a=rwork[1];
518  double x, D=0.0, C;
519 
520  if (b != 0.0)
521  {
522  D = (1.0/(exp(b/a)-1.0));
523  }
524  C = (-D)*exp(b/a);
525 
526  for (i=0;i<nPoints;i++)
527  {
528  x = X[i*3+0];
529  if (D != 0.0)
530  {
531  u[i] = (-D)*exp(b*x/a) - C;
532  }
533  else
534  {
535  u[i] = 1.0 - x;
536  }
537  }
538 
539  return 0;
540 }
541 
566 int LinearADR_Decay_DiracIC(int *iwork, double *rwork, int nPoints, double T, double *x, double *u)
567 /*
568 The exact solution of
569 
570  u_t + \deld(bu - a \grad u) + cu= 0
571 
572  on an infinite domain with Dirac initial data.
573  Also returns the fluxes (by inheritance).
574 */
575 {
576  int i, iret;
577  double c=rwork[10], tStart=rwork[5];
578  double t = T + tStart;
579 
580  iret = LinearAD_DiracIC(iwork, rwork, nPoints, T, x, u);
581  for (i=0; i<nPoints; i++)
582  {
583  u[i] *= exp(-c*t);
584  }
585 
586  return iret;
587 }
613 int LinearADR_Decay_DiracIC_dr(int *iwork, double *rwork, int nPoints, double T, double *x, double *u, double *dr)
614 {
615  int i, iret;
616  double c=rwork[10];
617 
618  iret = LinearADR_Decay_DiracIC(iwork, rwork, nPoints, T, x, u);
619 
620  for (i=0; i<nPoints; i++)
621  {
622  dr[i] = c;
623  }
624 
625  return iret;
626 }
652 int LinearADR_Decay_DiracIC_r(int *iwork, double *rwork, int nPoints, double T, double *x, double *u, double *r)
653 {
654  int i, iret;
655  double c=rwork[10];
656 
657  iret = LinearADR_Decay_DiracIC(iwork, rwork, nPoints, T, x, u);
658 
659  for (i=0; i<nPoints; i++)
660  {
661  r[i] = u[i] * c;
662  }
663 
664  return iret;
665 }
691 int LinearADR_Sine(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
692 /*
693  An exact solution and source term for
694 
695  \deld (\vec b u - \ten a \grad u) + c u + d = 0
696 
697  where
698 
699  u(x) = sin[\gvec \omega \cdot \vec x + \omega_0) ] = sin(Ax - b)
700  r(u,x) = - [(\ten a \gvec \omega] \cdot \gvec \omega) u
701  - (\vec b \cdot \omega) cos(Ax - b)
702  = c u + D cos(Ax - b)
703  = cu + d
704 
705  also returns the advective, diffusive, and total flux at a point.
706 */
707 {
708  int i=0;
709  double omega[3]={rwork[0],rwork[1],rwork[2]};
710  double omega0=rwork[3];
711  double Y;
712 
713  for (i=0;i<nPoints;i++)
714  {
715  Y = omega[0]*x[i*3+0] + omega[1]*x[i*3+1] + omega[2]*x[i*3+2] + omega0;
716  u[i] = sin(Y);
717  }
718 
719  return 0;
720 }
749 int LinearADR_Sine_advectiveVelocity(int *iwork, double *rwork, int nPoints, double t, double *x, double *f)
750 {
751  int i, j, iret;
752  double b[3]={rwork[4],rwork[5],rwork[6]};
753  double *u = (double *)malloc(nPoints * sizeof(double));
754 
755  /*for (i=0;i<nPoints;i++)
756  {
757  printf(" %d x = %f, %f, %f\n",i,x[i*3+0],x[i*3+1],x[i*3+2]);
758  }
759  */
760  iret = LinearADR_Sine(iwork, rwork, nPoints, t, x, u);
761 
762  for (i=0; i<nPoints; i++)
763  {
764  for (j=0; j<3; j++)
765  {
766  f[i*3+j] = u[i]*b[j];
767  }
768  }
769  free( u );
770 
771  return iret;
772 }
802 int LinearADR_Sine_diffusiveVelocity(int *iwork, double *rwork, int nPoints, double t, double *x, double *f)
803 {
804  int i, j, iret;
805  double a[3][3]={ {rwork[7],rwork[8],rwork[9]},{rwork[10],rwork[11],rwork[12]},{rwork[13],rwork[14],rwork[15]} };
806  double *du = (double *)malloc(nPoints*3*sizeof(double));
807 
808  iret = LinearADR_Sine_du(iwork, rwork, nPoints, t, x, du);
809 
810 // matrix multiplication of matrix a(3x3) and a vector x of nPoints.
811  for (i=0; i<nPoints; i++)
812  {
813  for (j=0; j<3; j++)
814  {
815  f[i*3+j] = -( a[j][0]*du[i*3+j] + a[j][1]*du[i*3+j] + a[j][2]*du[i*3+j] );
816  }
817  }
818  free(du);
819 
820  return iret;
821 }
851 int LinearADR_Sine_dr(int *iwork, double *rwork, int nPoints, double t, double *x, double *u, double *dr)
852 {
853  int i, iret;
854  double c=rwork[16];
855 
856  iret = LinearADR_Sine(iwork, rwork, nPoints, t, x, u);
857 
858  for (i=0; i<nPoints; i++)
859  {
860  dr[i] = c;
861  }
862 
863  return iret;
864 }
890 int LinearADR_Sine_du(int *iwork, double *rwork, int nPoints, double t, double *x, double *f)
891 {
892  int i, j;
893  double omega[3]={rwork[0],rwork[1],rwork[2]};
894  double omega0=rwork[3];
895  double Y;
896 
897  for (i=0;i<nPoints;i++)
898  {
899  Y = cos( omega[0]*x[i*3+0] + omega[1]*x[i*3+1] + omega[2]*x[i*3+2] + omega0 );
900  for (j=0; j<3; j++)
901  {
902  f[i*3+j] = omega[j] * Y;
903  }
904  }
905 
906  return 0;
907 }
938 int LinearADR_Sine_r(int *iwork, double *rwork, int nPoints, double t, double *x, double *u, double *r)
939 {
940  int i, j, iret;
941  double omega[3]={rwork[0],rwork[1],rwork[2]};
942  double omega0=rwork[3];
943  double b[3]={rwork[4],rwork[5],rwork[6]};
944  double a[3][3]={ {rwork[7],rwork[8],rwork[9]},{rwork[10],rwork[11],rwork[12]},{rwork[13],rwork[14],rwork[15]}};
945  double c=rwork[16];
946  double Y, D, E;
947  double MM[3];
948 
949  iret = LinearADR_Sine(iwork, rwork, nPoints, t, x, u);
950 
951 // matrix multiplication of 3x3 matrix and 3x1 vector
952  for (j=0; j<3; j++)
953  {
954  MM[j] = a[j][0]*omega[0] + a[j][1]*omega[1] + a[j][2]*omega[2];
955  }
956  E = - ( MM[0]*omega[0] + MM[1]*omega[1] + MM[2]*omega[2] ) - c;
957 
958 // dot product of vector b and vector omega
959  D = -( b[0]*omega[0] + b[1]*omega[1] + b[2]*omega[2] );
960 
961  for (i=0; i<nPoints; i++)
962  {
963  Y = omega[0]*x[i*3+0] + omega[1]*x[i*3+1] + omega[2]*x[i*3+2] + omega0;
964  r[i] = c*u[i] + D*cos(Y) + E*sin(Y);
965  }
966 
967  return iret;
968 }
997 int LinearADR_Sine_totalVelocity(int *iwork, double *rwork, int nPoints, double t, double *x, double *f)
998 {
999  int i, j, iret;
1000  double *f_adv = (double *)malloc(nPoints*3*sizeof(double));
1001 
1002  iret = LinearADR_Sine_advectiveVelocity(iwork, rwork, nPoints, t, x, f_adv);
1003  iret += LinearADR_Sine_diffusiveVelocity(iwork, rwork, nPoints, t, x, f);
1004 
1005  for (i=0;i<nPoints;i++)
1006  {
1007  for (j=0; j<3; j++)
1008  {
1009  f[i*3+j] += f_adv[i*3+j];
1010  }
1011  }
1012  free(f_adv);
1013 
1014  return iret;
1015 }
1035 /********************************************************************/
1036 int NonlinearAD_SteadyState(int *iwork, double *rwork, int nPoints, double t, double *X, double *u)
1037 /*
1038  (bu^q - a(u^r)_x)_x = 0
1039  u(0) = 1
1040  u(1) = 0
1041 */
1042 {
1043  int i, iret=0;
1044  int q=iwork[0], r=iwork[1];
1045  double b=rwork[0], a=rwork[1];
1046  double x, lu, f0, ff, fC;
1047  double C, rtmC=0.0, Ctmp, dC, nlC=0.0, nlD=0.0;
1048 
1049  if (q==2 && r==1)
1050  {
1051  if (b != 0.0)
1052  {
1053  printf( "Solving for sqrt(-C) for q=2, r=1\n");
1054  rtmC = sqrt(1.5);
1055  while ( fabs( f(rtmC,b,a,q,r) ) > 1.0E-8 )
1056  {
1057  rtmC -= ( f(rtmC,b,a,q,r) / df(rtmC,b,a,q,r) );
1058  }
1059  printf( "sqrt(-C)= %lf \n",rtmC);
1060  }
1061  }
1062  else if (q==1 && r==2)
1063  {
1064  printf( "\nSolving for C in q=1,r=2\n" );
1065  C = 1.0 + 1.0E-10;
1066  f0 = f(C,b,a,q,r);
1067  printf("f0 = %lf\n", f0);
1068  while ( fabs(f(C,b,a,q,r)) > (1.0E-7*fabs(f0) + 1.0E-7))
1069  {
1070  dC = -f(C,b,a,q,r)/df(C,b,a,q,r);
1071  printf("dc = %lf\n",dC);
1072  Ctmp = C + dC;
1073  while ( (fabs(ff=f(Ctmp,b,a,q,r)) > 0.99*fabs(fC=f(C,b,a,q,r))) || (Ctmp <= 1.0) )
1074  {
1075  printf("f(%lf) = %lf\n", Ctmp, ff);
1076  printf("f(%lf) = %lf\n", C, fC);
1077  printf( "ls\n" );
1078  dC *= 0.9 ;
1079  Ctmp = C + dC ;
1080  }
1081  printf( "out\n" );
1082  printf( "%lf \n",Ctmp);
1083 // are we printing the new values from the functions f & df?
1084  printf(" f(%lf) = %lf\n",Ctmp, f(Ctmp,b,a,q,r));
1085  printf("df(%lf) = %lf\n",Ctmp, df(Ctmp,b,a,q,r));
1086  C=Ctmp;
1087  }
1088  printf("C = %lf\n",C);
1089  nlC = C;
1090  nlD = 0.5*(2.0*C*log(C*(C-1)) - 4.0*C + 2.0 - b/a);
1091  printf( "D = %lf\n",nlD);
1092  }
1093  else
1094  {
1095  printf("q,r not implemented\n");
1096  return 0;
1097  }
1098 // Main Loop for uOfX
1099 
1100  if(q==1 && r==2)
1101  {
1102  iret = LinearAD_SteadyState(iwork, rwork, nPoints, t, X, u) ;
1103  }
1104 
1105  for (i=0; i<nPoints; i++)
1106  {
1107  x = X[i*3+0];
1108 
1109  if (q==2 && r==1)
1110  {
1111  if (b != 0.0)
1112  {
1113  u[i] = rtmC * tanh( (-b*rtmC/a)*(x - 1.0) );
1114  }
1115  else
1116  {
1117  u[i] = 1.0 - x;
1118  }
1119  }
1120  else if (q==1 && r==2)
1121  {
1122  lu = u[i];
1123  f0 = uOfX_f(a, b, nlC, nlD, x, lu) ;
1124  while ( fabs(uOfX_f(a, b, nlC, nlD, x, lu)) > (1.0E-6*fabs(f0) + 1.0E-6) )
1125  {
1126  lu -= uOfX_f(a, b, nlC, nlD, x, lu) / uOfX_df(nlC, lu) ;
1127  }
1128  u[i] = lu;
1129  }
1130  else
1131  {
1132  printf("q,r not implemented");
1133  }
1134  }
1135  return iret;
1136 }
1137 
1164 int NonlinearADR_Decay_DiracIC(int *iwork, double *rwork, int nPoints, double T, double *x, double *u)
1165 /*
1166 The approximate analytical solution of
1167 
1168  u_t + \deld(bu - a \grad u) + cu^d= 0
1169 
1170  on an infinite domain with Dirac initial data.
1171  Also returns the fluxes (by inheritance).
1172 */
1173 {
1174  int i, iret;
1175  double c=rwork[10], d=rwork[11], tStart=rwork[5];
1176  double t = T + tStart;
1177 
1178  iret = LinearAD_DiracIC(iwork, rwork, nPoints, T, x, u);
1179 
1180  for (i=0; i<nPoints; i++)
1181  {
1182  if (u[i] > 0.0)
1183  {
1184  u[i] *= exp( -(2.0*c*t*pow(u[i],(d-1.0)))/(d+1.0) );
1185  }
1186  }
1187 
1188  return iret;
1189 }
1216 int NonlinearADR_Decay_DiracIC_dr(int *iwork, double *rwork, int nPoints, double T, double *x, double *u, double* dr)
1217 {
1218  int i, iret;
1219  double c=rwork[10], d=rwork[11];
1220 
1221  iret = NonlinearADR_Decay_DiracIC(iwork, rwork, nPoints, T, x, u);
1222 
1223  for (i=0; i<nPoints; i++)
1224  {
1225  dr[i] = d*c*pow(u[i],(d-1.0));
1226  }
1227 
1228  return iret;
1229 }
1230 
1257 int NonlinearADR_Decay_DiracIC_r(int *iwork, double *rwork, int nPoints, double T, double *x, double *u, double* r)
1258 {
1259  int i, iret;
1260  double c=rwork[10], d=rwork[11];
1261 
1262  iret = NonlinearADR_Decay_DiracIC(iwork, rwork, nPoints, T, x, u);
1263 
1264  for (i=0; i<nPoints; i++)
1265  {
1266  r[i] = c*pow(u[i],d);
1267  }
1268 
1269  return iret;
1270 }
1271 
1287 int NonlinearDAE(int *iwork, double *rwork, int nPoints, double T, double *x, double *u)
1288 /*
1289  The exact solution of
1290 
1291  u_t = - a max(u,0)^p
1292  u(0) = 1
1293 */
1294 {
1295  int i;
1296  double q, t, a=rwork[0], p=rwork[1];
1297 
1298  for (i=0;i<nPoints;i++)
1299  {
1300  t = x[i*3+0];
1301 
1302  if (p == 1.0)
1303  {
1304  u[i] = exp( -a*t );
1305  }
1306  else
1307  {
1308  q = 1.0/(1.0 - p);
1309  u[i] = pow( max( (1.0 - (1.0 - p)*a*t), 0.0 ), q ) ;
1310  }
1311  }
1312 
1313  return 0;
1314 }
1330 int NonlinearDAE_f(int *iwork, double *rwork, int nPoints, double t, double *x, double *f)
1331 /*
1332  The exact solution of
1333 
1334  u_t = - a max(u,0)^p
1335  u(0) = 1
1336 */
1337 {
1338  int i, j;
1339  double a=rwork[0], p=rwork[1];
1340 
1341  for (i=0;i<nPoints;i++)
1342  {
1343  for (j=0; j<3; j++)
1344  {
1345  f[i*3+j] = -a*pow(max(f[i*3+j],0.0),p) ;
1346  }
1347  }
1348 
1349  return 0;
1350 }
1351 
1380 int PlanePoiseuilleFlow_u(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
1381 {
1382 /*
1383  Poiseuille Flow between two parallel fixed plates with constant seperation (width)
1384 
1385  h = width between plates
1386  GradP = Pressure gradient (neg.)
1387  mu = viscosity
1388  q = rate of flow per unit width
1389  xs,ys,zs = axis offset
1390  Axis of origin: bottom plate
1391  Vmax = maximum velocity at the centerline
1392 
1393  -\delp + mu \del^2(\u_x) = 0
1394 
1395  given either -GradP: u_{max} = -GradP / (2 * mu) * (h/2)^2
1396  or q : u_{max} = 3/2 * (q / h)
1397 
1398  u(y) = 4 * u_{max} * Y * (h-Y) / h^2
1399 
1400  u(0) = u(h) = 0
1401  u(h/2) = u_{max}
1402  u_{max} = -GradP / (2 * mu) * (h/2)<sup>2</sup>\n
1403  or \n
1404  u_{max} = 3/2 * (q / h)
1405 */
1406  int i;
1407  double h=rwork[0], mu=rwork[1];
1408  double GradP = rwork[2], q = rwork[3];
1409  double ys=rwork[5];
1410  double umax;
1411  double Y;
1412 
1413  if(GradP != 0.0)
1414  {
1415  umax = -GradP *(1.0/(2.0*mu)) * (h*h/4.0);
1416  }
1417  else if(q != 0.0)
1418  {
1419  umax = (3.0/2.0)*q/h;
1420  }
1421  else
1422  {
1423  printf("Please enter input values for either q(Flow Rate per unit depth) or GradP(Pressure Gradient)\n");
1424  exit (0);
1425  }
1426 
1427  for (i=0; i<nPoints; i++)
1428  {
1429  Y = x[i*3+1] - ys;
1430 
1431  u[i] = (4.0*umax*Y*(h-Y))/(h*h);
1432  }
1433 
1434  return 0;
1435 }
1466 int PoiseuillePipeFlow(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
1467 {
1468 /*
1469  Poiseuille Flow through a circular pipe
1470  Velocity in the direction of flow (z-dir)
1471 
1472  R = radius of pipe
1473  GradP = Pressure gradient (neg.)
1474  mu = viscosity
1475  Q = Rate of Flow
1476  Axis of origin: center of pipe
1477  xs,ys,zs = axis offset
1478 
1479  x-momentum equation in cylindrical coordinates
1480  Vr = Vtheta = 0
1481  -\\delp + mu \\del^2(Vx) = 0
1482 
1483  No transformation of coordinates is required for x.
1484 
1485  Vmax = -GradP * R^2/(4 * mu)\n
1486  or \n
1487  Vmax = 2 * Q / Pipe Area\n
1488 
1489  Vx(r) = Vmax * (1 - r^2/R^2)
1490 
1491  Vx(0) = Vmax
1492  Vx(R) = 0
1493  Vmax = -GradP * R<sup>2</sup>/(4 * mu)\n
1494  or\n
1495  Vmax = 2 * Q / Pipe Area\n
1496 
1497 */
1498  int i;
1499  double r=rwork[0], mu = rwork[1];
1500  double GradP=rwork[2], Q=rwork[3];
1501  double ys=rwork[5];
1502  double umax;
1503  double Y;
1504 
1505  if(GradP != 0.0)
1506  {
1507  umax = -GradP *(r*r/(4.0*mu));
1508  }
1509  else if(Q != 0.0)
1510  {
1511  umax = 2.0*Q/(PI * r*r);
1512  }
1513  else
1514  {
1515  printf("Please enter input values for either Q(Flow Rate) or GradP(Pressure Gradient)\n");
1516  exit (0);
1517  }
1518 
1519  for (i=0; i<nPoints; i++)
1520  {
1521  Y = x[i*3+1] - ys;
1522 
1523  u[i] = umax*(1.0 - ((Y*Y)/(r*r)));
1524  }
1525 
1526  return 0;
1527 }
1554 int PoiseuillePipeFlow_P(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
1555 {
1556 /*
1557  Poiseuille Flow through a circular pipe
1558  Velocity in the direction of flow (z-dir)
1559 
1560  R = radius of pipe
1561  GradP = Pressure gradient (neg.)
1562  mu = viscosity
1563  Q = Rate of Flow
1564  Axis of origin: center of pipe
1565  xs,ys,zs = axis offset
1566  P = pressure
1567 
1568  x-momentum equation in cylindrical coordinates
1569  Vr = Vtheta = 0
1570  -GradP + mu \del^2(Vx) = 0
1571 
1572  For Q given:\n
1573  GradP = (8 * Q * mu) / (R<sup>2</sup> * Pipe Area)
1574  assumuption: P1 = atmospheric pressure = 0.0
1575 */
1576  int i;
1577  double r=rwork[0], mu=rwork[1];
1578  double GradP=rwork[2], Q=rwork[3], L=rwork[4];
1579  double xs=rwork[5];
1580  double X;
1581 
1582 
1583  if(GradP == 0.0 && Q != 0.0)
1584  {
1585  GradP = - (8.0*Q*mu) / (PI*pow(r,4.0));
1586  }
1587  else if(GradP == 0.0)
1588  {
1589  printf("Please enter input values for either Q(Flow Rate) OR GradP(Pressure Gradient)\n");
1590  exit(0);
1591  }
1592 
1593  for (i=0; i<nPoints; i++)
1594  {
1595  X = x[i*3+0] - xs;
1596 
1597  u[i] = -GradP*L*(1.0-X);
1598  }
1599 
1600  return 0;
1601 }
1620 int poissonsEquationExp1D(int *iwork, double *rwork, int nPoints, double t, double *X, double *u)
1621 {
1622 /*
1623  -u_{xx} - f = 0
1624  u = K x(1-x)y(1-y)z(1-z)e^{x^2 + y^2 + z^2}
1625  f = -K {> [y(1-y)z(1-z)][4x^3 - 4x^2 + 6x - 2]+
1626  [x(1-x)z(1-z)][4y^3 - 4y^2 + 6y - 2]+
1627  [x(1-x)y(1-y)][4z^3 - 4z^2 + 6z - 2]}e^{x^2 + y^2 + z^2}
1628 */
1629 
1630  int i=0;
1631  double K=rwork[0];
1632  double x;
1633 
1634  for (i=0;i<nPoints;i++)
1635  {
1636  x = X[i*3+0];
1637  u[i] = K*x*(1.0-x)*exp(x*x);
1638  }
1639 
1640  return 0;
1641 }
1659 int poissonsEquationExp2D(int *iwork, double *rwork, int nPoints, double t, double *X, double *u)
1660 {
1661  int i=0;
1662  double K=rwork[0];
1663  double x, y;
1664 
1665  for (i=0;i<nPoints;i++)
1666  {
1667  x = X[i*3+0];
1668  y = X[i*3+1];
1669  u[i] = K*x*(1.0-x)*y*(1.0-y)*exp(x*x + y*y);
1670  }
1671  return 0;
1672 }
1690 int poissonsEquationExp3D(int *iwork, double *rwork, int nPoints, double t, double *X, double *u)
1691 {
1692  int i=0;
1693  double K=rwork[0];
1694  double x, y, z;
1695 
1696  for (i=0;i<nPoints;i++)
1697  {
1698  x = X[i*3+0];
1699  y = X[i*3+1];
1700  z = X[i*3+2];
1701  u[i] = K*x*(1.0-x)*y*(1.0-y)*z*(1.0-z)*exp(x*x + y*y + z*z);
1702  }
1703 
1704  return 0;
1705 }
1724 int poissonsEquationExp3D_dr(int *iwork, double *rwork, int nPoints, double t, double *X, double *u, double *dr)
1725 {
1726  int i;
1727 
1728  for (i=0; i<nPoints; i++)
1729  {
1730  dr[i] = 0.0;
1731  }
1732 
1733  return 0;
1734 }
1735 
1754 int poissonsEquationExp1D_r(int *iwork, double *rwork, int nPoints, double t, double *X, double *u, double *r)
1755 {
1756  int i=0;
1757  double K=rwork[0];
1758  double x;
1759 
1760  for (i=0;i<nPoints;i++)
1761  {
1762  x = X[i*3+0];
1763 
1764  r[i] = K*(4.0*(1.0-x)*pow(x,3.0) - 4.0*x*x + 6.0*(1.0-x)*x - 2.0)*exp(x*x) ;
1765  }
1766 
1767  return 0;
1768 }
1787 int poissonsEquationExp2D_r(int *iwork, double *rwork, int nPoints, double t, double *X, double *u, double *r)
1788 {
1789  int i=0;
1790  double K=rwork[0];
1791  double x, y;
1792 
1793  for (i=0;i<nPoints;i++)
1794  {
1795  x = X[i*3+0];
1796  y = X[i*3+1];
1797 
1798  r[i] = K*(y*(1.0-y)*(4.0*(1.0-x)*pow(x,3) - 4.0*x*x + 6.0*x*(1.0-x) - 2.0) +
1799  x*(1.0-x)*(4.0*(1.0-y)*pow(y,3) - 4.0*y*y + 6.0*y*(1.0-y) - 2.0))*exp(x*x + y*y);
1800  }
1801 
1802  return 0;
1803 }
1822 int poissonsEquationExp3D_r(int *iwork, double *rwork, int nPoints, double t, double *X, double *u, double *r)
1823 {
1824  int i=0;
1825  double K=rwork[0];
1826  double x,y,z;
1827 
1828  for (i=0; i<nPoints; i++)
1829  {
1830  x = X[i*3+0];
1831  y = X[i*3+1];
1832  z = X[i*3+2];
1833 
1834  r[i] = K*(y*(1.0-y)*z*(1.0-z)*(4.0*(1.0-x)*pow(x,3) - 4.0*x*x + 6.0*x*(1.0-x) - 2.0) +
1835  x*(1.0-x)*z*(1.0-z)*(4.0*(1.0-y)*pow(y,3) - 4.0*y*y + 6.0*y*(1.0-y) - 2.0) +
1836  x*(1.0-x)*y*(1.0-y)*(4.0*(1.0-z)*pow(z,3) - 4.0*z*z + 6.0*z*(1.0-z) - 2.0))*exp(x*x + y*y + z*z);
1837  }
1838 
1839  return 0;
1840 }
1841 
1864 int STflowSphere_P(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
1865 {
1866 /*
1867  Stokes Flow around Sphere of radius r^s and center x^s, y^s, z^s.
1868  Velocity is u,v,w and viscosity is mu.
1869  Array rwork contains all the above variables.
1870  Input : t, x
1871  : x[npoints*3] = {x,y,z} for each point
1872  : rwork[] = {uu,v,w,rS,xS,yS,zS,mu}
1873  Output : P
1874 */
1875  int i;
1876  double vx=rwork[0], vy=rwork[1], vz=rwork[2];
1877  double rS=rwork[3], xS=rwork[4], yS=rwork[5], zS=rwork[6];
1878  double mu=rwork[7];
1879  double eR[3],eTHETA[3];
1880  double norm_v,theta,r;
1881 
1882  for (i=0; i<nPoints; i++)
1883  {
1884  coords(vx,vy,vz,
1885  xS,yS,zS,
1886  &x[i*3],
1887  &r,
1888  &theta,
1889  &norm_v,
1890  eR,
1891  eTHETA);
1892  if (r >= rS)
1893  u[i] = (-3.0*rS*mu*norm_v*cos(theta))/(2.0*r*r);
1894  else
1895  u[i]=0.0;
1896  }
1897 
1898  return 0;
1899 }
1900 
1929 int STflowSphere_Vx(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
1930 {
1931 /*
1932  Stokes Flow around Sphere of radius r^s and center x^s, y^s, z^s.
1933  Velocity is u,v,w and viscosity is mu..
1934  Input : t, x
1935  : x[npoints*3] = {x,y,z} for each point
1936  : rwork[] = {uu,v,w,rS,xS,yS,zS,mu}
1937  Output : Vx
1938 */
1939  int i;
1940  double vx=rwork[0], vy=rwork[1], vz=rwork[2];
1941  double rS=rwork[3], xS=rwork[4], yS=rwork[5], zS=rwork[6];
1942  double eR[3],eTHETA[3];
1943  double norm_v,theta,r;
1944  double vR,vTHETA;
1945 
1946  for (i=0; i<nPoints; i++)
1947  {
1948  coords(vx,vy,vz,
1949  xS,yS,zS,
1950  &x[i*3],
1951  &r,
1952  &theta,
1953  &norm_v,
1954  eR,
1955  eTHETA);
1956  vel(rS,norm_v,r,theta,&vR,&vTHETA);
1957  u[i] = vR * eR[0]+ vTHETA * eTHETA[0];
1958  }
1959 
1960  return 0;
1961 }
1962 
1992 int STflowSphere_Vy(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
1993 {
1994 /*
1995  Stokes Flow around Sphere of radius r^s and center x^s, y^s, z^s.
1996  Velocity is u,v,w and viscosity is mu.
1997  Array rwork contains all the above variables.
1998  Input : t, x
1999  : x[npoints*3] = {x,y,z} for each point
2000  : rwork[] = {uu,v,w,rS,xS,yS,zS,mu}
2001  Output : Vy
2002 */
2003  int i;
2004  double vx=rwork[0], vy=rwork[1], vz=rwork[2];
2005  double rS=rwork[3], xS=rwork[4], yS=rwork[5], zS=rwork[6];
2006  double eR[3],eTHETA[3];
2007  double norm_v,theta,r;
2008  double vR,vTHETA;
2009 
2010  for (i=0; i<nPoints; i++)
2011  {
2012  coords(vx,vy,vz,
2013  xS,yS,zS,
2014  &x[i*3],
2015  &r,
2016  &theta,
2017  &norm_v,
2018  eR,
2019  eTHETA);
2020  vel(rS,norm_v,r,theta,&vR,&vTHETA);
2021  u[i] = vR * eR[1] + vTHETA * eTHETA[1];
2022  }
2023 
2024  return 0;
2025 }
2055 int STflowSphere_Vz(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
2056 {
2057 /*
2058  Stokes Flow around Sphere of radius r^s and center x^s, y^s, z^s.
2059  Velocity is u,v,w and viscosity is mu.
2060  Array rwork contains all the above variables.
2061  Input : t, x
2062  : x[npoints*3] = {x,y,z} for each point
2063  : rwork[] = {uu,v,w,rS,xS,yS,zS,mu}
2064  Output : Vz
2065 */
2066  int i;
2067  double vx=rwork[0], vy=rwork[1], vz=rwork[2];
2068  double rS=rwork[3], xS=rwork[4], yS=rwork[5], zS=rwork[6];
2069  double eR[3],eTHETA[3];
2070  double norm_v,theta,r;
2071  double vR,vTHETA;
2072 
2073  for (i=0; i<nPoints; i++)
2074  {
2075  coords(vx,vy,vz,
2076  xS,yS,zS,
2077  &x[i*3],
2078  &r,
2079  &theta,
2080  &norm_v,
2081  eR,
2082  eTHETA);
2083  vel(rS,norm_v,r,theta,&vR,&vTHETA);
2084  u[i] = vR * eR[2] + vTHETA* eTHETA[2];
2085  }
2086 
2087  return 0;
2088 }
2089 
2090 /********************************************************************/
2093 void coords(double vx, double vy, double vz,
2094  double xS, double yS, double zS,
2095  double* x,
2096  double* r,
2097  double* theta,
2098  double* norm_v,
2099  double* eR,
2100  double* eTHETA)
2101 {
2102  double xBar[3],
2103  norm_xBar,
2104  xBar_dot_v,
2105  eTHETA_dot_eR,
2106  norm_eTHETA;
2107 
2108  *norm_v = sqrt(vx*vx+vy*vy+vz*vz);
2109 
2110  xBar[0]=x[0]-xS;
2111  xBar[1]=x[1]-yS;
2112  xBar[2]=x[2]-zS;
2113 
2114  norm_xBar = sqrt(xBar[0]*xBar[0] + xBar[1]*xBar[1] + xBar[2]*xBar[2]);
2115 
2116  *r = norm_xBar;
2117 
2118  if (norm_xBar != 0.0)
2119  {
2120  eR[0]=xBar[0]/norm_xBar;
2121  eR[1]=xBar[1]/norm_xBar;
2122  eR[2]=xBar[2]/norm_xBar;
2123  }
2124  else
2125  {
2126  eR[0]=0.0;
2127  eR[1]=0.0;
2128  eR[2]=0.0;
2129  }
2130  xBar_dot_v = xBar[0]*vx + xBar[1]*vy + xBar[2]*vz;
2131 
2132  if (norm_xBar != 0.0)
2133  *theta = acos(xBar_dot_v/(norm_xBar*(*norm_v)));
2134  else
2135  *theta = 0.0;
2136 
2137  eTHETA[0] = eR[0] - vx/(*norm_v);
2138  eTHETA[1] = eR[1] - vy/(*norm_v);
2139  eTHETA[2] = eR[2] - vz/(*norm_v);
2140 
2141  eTHETA_dot_eR = eTHETA[0]*eR[0] + eTHETA[1]*eR[1] + eTHETA[2]*eR[2];
2142 
2143  eTHETA[0] -= eTHETA_dot_eR*eR[0];
2144  eTHETA[1] -= eTHETA_dot_eR*eR[1];
2145  eTHETA[2] -= eTHETA_dot_eR*eR[2];
2146 
2147  norm_eTHETA = sqrt(eTHETA[0]*eTHETA[0] + eTHETA[1]*eTHETA[1] + eTHETA[2]*eTHETA[2]);
2148 
2149  if (norm_eTHETA > 0.0)
2150  {
2151  eTHETA[0]/= norm_eTHETA;
2152  eTHETA[1]/= norm_eTHETA;
2153  eTHETA[2]/= norm_eTHETA;
2154  }
2155  else
2156  {
2157  eTHETA[0]=0.0;
2158  eTHETA[1]=0.0;
2159  eTHETA[2]=0.0;
2160  }
2161 }
2162 
2163 void vel(double rS, double norm_v, double r, double theta, double* vR, double* vTHETA)
2164 {
2165  if(r > rS)
2166  {
2167  *vR = norm_v * cos(theta) * ( 1.0 - (3.0*rS/(2.0*r)) + (pow(rS,3.0)/(2.0*pow(r,3.0))) );
2168  *vTHETA = -norm_v * sin(theta) * ( 1.0 - (3.0*rS/(4.0*r)) - (pow(rS,3.0)/(4.0*pow(r,3.0))) );
2169  }
2170  else
2171  {
2172  *vR = 0.0;
2173  *vTHETA = 0.0;
2174  }
2175 }
2176 /********************************************************************/
2177 double uOfX_df(double nlC, double lu)
2178 {
2179  return ( (2.0*nlC/(lu-nlC)+2.0) );
2180 }
2181 double uOfX_f(double a, double b, double nlC, double nlD, double x, double lu)
2182 {
2183  return ( (2.0 * (nlC * log(nlC-lu) - (nlC-lu)) - nlD) - b*x/a );
2184 }
2185 double f(double C, double b, double a, int q, int r)
2186 {
2187  if (q==2 && r==1)
2188  {
2189  if (b != 0.0)
2190  {
2191  return ( C*tanh(b*C/a) - 1.0 );
2192  }
2193  else
2194  {
2195  printf("function f(q=2,r=1,b=0) returns -99999.99\n");
2196  return -99999.99;
2197  }
2198  }
2199  else if (q==1 && r==2)
2200  {
2201  return ( 2.0*C*(log(C-1.0) - log(C)) + 2.0 + b/a );
2202  }
2203  else
2204  {
2205  printf("q,r not implemented: function f returns -99999.99\n");
2206  return -99999.99;
2207  }
2208 }
2209 double df(double C, double b, double a, int q, int r)
2210 {
2211  if (q==2 && r==1)
2212  {
2213  if (b != 0.0)
2214  {
2215  return ( C*(1.0/pow(cosh(b*C/a),2))*(b/a) + tanh(b*C/a) );
2216  }
2217  else
2218  {
2219  printf("function df(q=2,r=1,b=0) returns -99999.99\n");
2220  return -99999.99;
2221  }
2222  }
2223  else if (q==1 && r==2)
2224  {
2225  return ( 2.0*(log(C-1.0) - log(C)) + 2.0*C*(1.0/(C-1.0) - 1.0/C) ) ;
2226 
2227  }
2228  else
2229  {
2230  printf("q,r not implemented: function df returns -99999.99\n");
2231  return -99999.99;
2232  }
2233 
2234 }
2235 /********************************************************************/
2236 
LinearADR_Sine_diffusiveVelocity
int LinearADR_Sine_diffusiveVelocity(int *iwork, double *rwork, int nPoints, double t, double *x, double *f)
Linear Avection Diffusion Reaction Sine function (diffusive velocity)
Definition: analyticalSolutions.c:802
STflowSphere_Vy
int STflowSphere_Vy(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
Stokes Flow around moving Sphere.
Definition: analyticalSolutions.c:1992
diffusionSin1D_r
int diffusionSin1D_r(int *iwork, double *rwork, int nPoints, double t, double *x, double *u, double *r)
Sinusoidal 1D diffusion (reaction)
Definition: analyticalSolutions.c:172
Y
Double * Y
Definition: Headers.h:48
poissonsEquationExp3D
int poissonsEquationExp3D(int *iwork, double *rwork, int nPoints, double t, double *X, double *u)
Poisson Exponential Equation 3D.
Definition: analyticalSolutions.c:1690
LinearADR_Sine_dr
int LinearADR_Sine_dr(int *iwork, double *rwork, int nPoints, double t, double *x, double *u, double *dr)
Linear Avection Diffusion Reaction Sine function (dr)
Definition: analyticalSolutions.c:851
PoiseuillePipeFlow_P
int PoiseuillePipeFlow_P(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
Poiseuille Flow through a circular pipe.
Definition: analyticalSolutions.c:1554
NonlinearADR_Decay_DiracIC_dr
int NonlinearADR_Decay_DiracIC_dr(int *iwork, double *rwork, int nPoints, double T, double *x, double *u, double *dr)
Non Linear Avection Diffusion Reaction Decay Dirac Initial Condition (dr)
Definition: analyticalSolutions.c:1216
poissonsEquationExp2D
int poissonsEquationExp2D(int *iwork, double *rwork, int nPoints, double t, double *X, double *u)
Poisson Exponential Equation 2D.
Definition: analyticalSolutions.c:1659
D
#define D(x, y)
Definition: jf.h:9
LinearAD_DiracIC_advectiveVelocity
int LinearAD_DiracIC_advectiveVelocity(int *iwork, double *rwork, int nPoints, double T, double *x, double *f)
Linear Advective Diffusion Dirac Initial Condition(advective velocity)
Definition: analyticalSolutions.c:337
poissonsEquationExp1D_r
int poissonsEquationExp1D_r(int *iwork, double *rwork, int nPoints, double t, double *X, double *u, double *r)
Poisson Exponential Equation 1D (reaction)
Definition: analyticalSolutions.c:1754
poissonsEquationExp1D
int poissonsEquationExp1D(int *iwork, double *rwork, int nPoints, double t, double *X, double *u)
Poisson Exponential Equation 1D.
Definition: analyticalSolutions.c:1620
NonlinearDAE_f
int NonlinearDAE_f(int *iwork, double *rwork, int nPoints, double t, double *x, double *f)
Nonlinear Differential-algebraic equations.
Definition: analyticalSolutions.c:1330
NonlinearDAE
int NonlinearDAE(int *iwork, double *rwork, int nPoints, double T, double *x, double *u)
Nonlinear Differential-algebraic equations.
Definition: analyticalSolutions.c:1287
L
Double L
Definition: Headers.h:72
PoiseuillePipeFlow
int PoiseuillePipeFlow(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
Poiseuille Flow through a circular pipe.
Definition: analyticalSolutions.c:1466
n
Int n
Definition: Headers.h:28
q
Double q
Definition: Headers.h:81
df
double df(double C, double b, double a, int q, int r)
Definition: analyticalSolutions.c:2209
diffusionSin2D
int diffusionSin2D(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
Sinusoidal 2D diffusion.
Definition: analyticalSolutions.c:111
diffusionSin3D
int diffusionSin3D(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
Sinusoidal 3D diffusion.
Definition: analyticalSolutions.c:141
vel
void vel(double rS, double norm_v, double r, double theta, double *vR, double *vTHETA)
Definition: analyticalSolutions.c:2163
LinearAD_SteadyState
int LinearAD_SteadyState(int *iwork, double *rwork, int nPoints, double t, double *X, double *u)
Linear Advection-Diffusion Steady State.
Definition: analyticalSolutions.c:508
vx
Double vx
Definition: Headers.h:97
NonlinearADR_Decay_DiracIC_r
int NonlinearADR_Decay_DiracIC_r(int *iwork, double *rwork, int nPoints, double T, double *x, double *u, double *r)
Non Linear Avection Diffusion Reaction Decay Dirac Initial Condition (reaction)
Definition: analyticalSolutions.c:1257
STflowSphere_Vx
int STflowSphere_Vx(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
Stokes Flow around moving Sphere.
Definition: analyticalSolutions.c:1929
poissonsEquationExp3D_dr
int poissonsEquationExp3D_dr(int *iwork, double *rwork, int nPoints, double t, double *X, double *u, double *dr)
Poisson Exponential Equation 3D (dr)
Definition: analyticalSolutions.c:1724
LinearADR_Sine_du
int LinearADR_Sine_du(int *iwork, double *rwork, int nPoints, double t, double *x, double *f)
Linear Avection Diffusion Reaction Sine function (du)
Definition: analyticalSolutions.c:890
T
Double T
Definition: Headers.h:87
vy
Double vy
Definition: Headers.h:98
poissonsEquationExp3D_r
int poissonsEquationExp3D_r(int *iwork, double *rwork, int nPoints, double t, double *X, double *u, double *r)
Poisson Exponential Equation 3D (reaction)
Definition: analyticalSolutions.c:1822
z
Double * z
Definition: Headers.h:49
u
Double u
Definition: Headers.h:89
c
Double c
Definition: Headers.h:54
LinearADR_Sine_advectiveVelocity
int LinearADR_Sine_advectiveVelocity(int *iwork, double *rwork, int nPoints, double t, double *x, double *f)
Linear Avection Diffusion Reaction Sine function (advective velocity)
Definition: analyticalSolutions.c:749
diffusionSin2D_r
int diffusionSin2D_r(int *iwork, double *rwork, int nPoints, double t, double *x, double *u, double *r)
Sinusoidal 2D diffusion (reaction)
Definition: analyticalSolutions.c:200
poissonsEquationExp2D_r
int poissonsEquationExp2D_r(int *iwork, double *rwork, int nPoints, double t, double *X, double *u, double *r)
Poisson Exponential Equation 2D (reaction)
Definition: analyticalSolutions.c:1787
NonlinearADR_Decay_DiracIC
int NonlinearADR_Decay_DiracIC(int *iwork, double *rwork, int nPoints, double T, double *x, double *u)
Non Linear Avection Diffusion Reaction Decay Dirac Initial Condition.
Definition: analyticalSolutions.c:1164
PlaneCouetteFlow_u
int PlaneCouetteFlow_u(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
Couette Flow between two parallel plates. One moving relative to the other with constant seperation (...
Definition: analyticalSolutions.c:36
LinearADR_Decay_DiracIC
int LinearADR_Decay_DiracIC(int *iwork, double *rwork, int nPoints, double T, double *x, double *u)
Linear Avection Diffusion Reaction Decay Dirac Initial Condition.
Definition: analyticalSolutions.c:566
STflowSphere_Vz
int STflowSphere_Vz(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
Stokes Flow around moving Sphere.
Definition: analyticalSolutions.c:2055
Q
Double Q
Definition: Headers.h:80
LinearAD_DiracIC_totalVelocity
int LinearAD_DiracIC_totalVelocity(int *iwork, double *rwork, int nPoints, double T, double *x, double *f)
Linear Advective Diffusion Dirac Initial Condition(total velocity)
Definition: analyticalSolutions.c:471
LinearADR_Decay_DiracIC_r
int LinearADR_Decay_DiracIC_r(int *iwork, double *rwork, int nPoints, double T, double *x, double *u, double *r)
Linear Avection Diffusion Reaction Decay Dirac Initial Condition (reaction)
Definition: analyticalSolutions.c:652
LinearADR_Sine_totalVelocity
int LinearADR_Sine_totalVelocity(int *iwork, double *rwork, int nPoints, double t, double *x, double *f)
Linear Avection Diffusion Reaction Sine function (total velocity)
Definition: analyticalSolutions.c:997
LinearADR_Sine_r
int LinearADR_Sine_r(int *iwork, double *rwork, int nPoints, double t, double *x, double *u, double *r)
Linear Avection Diffusion Reaction Sine function (reaction)
Definition: analyticalSolutions.c:938
LinearAD_DiracIC_du
int LinearAD_DiracIC_du(int *iwork, double *rwork, int nPoints, double T, double *x, double *f)
Linear Advective Diffusion Dirac Initial Condition (du)
Definition: analyticalSolutions.c:423
LinearADR_Sine
int LinearADR_Sine(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
Linear Avection Diffusion Reaction Sine function.
Definition: analyticalSolutions.c:691
LinearAD_DiracIC
int LinearAD_DiracIC(int *iwork, double *rwork, int nPoints, double T, double *x, double *u)
Linear Advective Diffusion Dirac Initial Condition.
Definition: analyticalSolutions.c:273
LinearAD_DiracIC_diffusiveVelocity
int LinearAD_DiracIC_diffusiveVelocity(int *iwork, double *rwork, int nPoints, double T, double *x, double *f)
Linear Advective Diffusion Dirac Initial Condition(diffusive velocity)
Definition: analyticalSolutions.c:381
PlanePoiseuilleFlow_u
int PlanePoiseuilleFlow_u(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
Poiseuille Flow between two parallel fixed plates with constant seperation (width).
Definition: analyticalSolutions.c:1380
r
Double r
Definition: Headers.h:83
NonlinearAD_SteadyState
int NonlinearAD_SteadyState(int *iwork, double *rwork, int nPoints, double t, double *X, double *u)
Nonlinear Advection-Diffusion Steady State.
Definition: analyticalSolutions.c:1036
analyticalSolutions.h
LinearADR_Decay_DiracIC_dr
int LinearADR_Decay_DiracIC_dr(int *iwork, double *rwork, int nPoints, double T, double *x, double *u, double *dr)
Linear Avection Diffusion Reaction Decay Dirac Initial Condition (dr)
Definition: analyticalSolutions.c:613
max
#define max(a, b)
Definition: analyticalSolutions.h:14
STflowSphere_P
int STflowSphere_P(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
Stokes Flow around moving Sphere.
Definition: analyticalSolutions.c:1864
coords
void coords(double vx, double vy, double vz, double xS, double yS, double zS, double *x, double *r, double *theta, double *norm_v, double *eR, double *eTHETA)
Definition: analyticalSolutions.c:2093
diffusionSin3D_r
int diffusionSin3D_r(int *iwork, double *rwork, int nPoints, double t, double *x, double *u, double *r)
Sinusoidal 3D diffusion (reaction)
Definition: analyticalSolutions.c:231
f
double f(double C, double b, double a, int q, int r)
Definition: analyticalSolutions.c:2185
diffusionSin1D
int diffusionSin1D(int *iwork, double *rwork, int nPoints, double t, double *x, double *u)
Sinusoidal 1D diffusion.
Definition: analyticalSolutions.c:84
uOfX_f
double uOfX_f(double a, double b, double nlC, double nlD, double x, double lu)
Definition: analyticalSolutions.c:2181
uOfX_df
double uOfX_df(double nlC, double lu)
Definition: analyticalSolutions.c:2177