PLUTO
init.c
Go to the documentation of this file.
1 /* ///////////////////////////////////////////////////////////////////// */
2 /*!
3  \file
4  \brief Taylor-Couette Flow in 2D cylindrical coordinates.
5 
6  This problem considers a fluid rotating between two concentric
7  cylinders situated at \f$ R_{\rm int}\f$ and \f$ R_{\rm ext}\f$
8  (fixed by the computational domain in \c pluto.ini).
9  The outer cylinder is not rotating while the inner one rotates with
10  anular velocity \f$\omega\f$.
11  Viscous effects are controlled by the Reynolds number defined in
12  \c visc_nu.c as
13  \f[
14  {\rm Re} = \Omega R_{int}\left(R_{\rm ext} - R_{\rm int}\right)
15  \frac{\rho}{\nu_1}
16  \f]
17  For Reynolds numbers \f${\rm Re} > {\rm Re}_{\rm critical}\sim 130\f$
18  vortices are formed, the axial distribution of which is controlled by
19  the wave-number of the initial perturbation \f$\kappa = 2 \pi / \lambda\f$.
20  For small Reynolds numbers, viscosity suppresses the vortex formation.
21 
22  The input parameters for this problem are:
23 
24  - <tt>g_inputParam[OMEGA]</tt>: the angular velocity of the inner cylinder.
25  - <tt>g_inputParam[REYN]</tt>: the Reynolds number.
26 
27  \author P. Tzeferacos (petros.tzeferacos@ph.unito.it)\n
28  A. Mignone (mignone@ph.unito.it)
29  \date June 4, 2010
30 
31  \b References
32  - "Stability of a viscous liquid contained between two rotating cylinders",
33  Taylor G.I., 1923, Philos. Trans. R. Soc. London, Ser. A, 223, 289
34  - "Taylor vortex formation in axial through-flow: Linear and
35  weakly nonlinear analysis", Recktenwald A., L\"ucke M., M\"uller H.W.,
36  1993, Phys. Rev. E, 48, 4444
37 */
38 /* ///////////////////////////////////////////////////////////////////// */
39 #include "pluto.h"
40 
41 /* ********************************************************************* */
42 void Init (double *v, double x1, double x2, double x3)
43 /*
44  *
45  *********************************************************************** */
46 {
47  double rmin = g_domBeg[IDIR];
48  double rmax = g_domEnd[IDIR];
49  double eta = rmin/rmax;
50  double lambda = (rmax-rmin);
51  double A = -g_inputParam[OMEGA]*eta*eta/(1.0 - eta*eta);
52  double B = g_inputParam[OMEGA]*rmin*rmin/(1.0 - eta*eta);
53  double SPER = sin(2.*CONST_PI*x2/lambda);
54  double CPER = cos(2.*CONST_PI*x2/lambda);
55 
56  v[RHO] = 1.0;
57  v[PRS] = 10.+ 0.5*(A*A*x1*x1 +4.*A*B*log(x1) - B*B/x1/x1)
58  + 0.01*0.5*(A*A*x1*x1 +4.*A*B*log(x1) - B*B/x1/x1)*CPER;
59  v[VX1] = 0.01*(A*x1 + B/x1)*CPER;
60  v[VX2] = 0.01*(A*x1 + B/x1)*SPER;
61  v[VX3] = A*x1 + B/x1 + 0.01*(A*x1 + B/x1)*CPER;
62  v[TRC] = 1.0;
63 }
64 /* ********************************************************************* */
65 void Analysis (const Data *d, Grid *grid)
66 /*
67  *
68  *
69  *********************************************************************** */
70 {
71 
72 }
73 /* ********************************************************************* */
74 void UserDefBoundary (const Data *d, RBox *box, int side, Grid *grid)
75 /*!
76  * Assign user-defined boundary conditions at inner and outer
77  * radial boundaries. Reflective conditions are applied except for
78  * the azimuthal velocity which is fixed.
79  *
80  *********************************************************************** */
81 {
82  int i, j, k, nv;
83  double *x1, *x2, *x3;
84 
85  x1 = grid[IDIR].x;
86  x2 = grid[JDIR].x;
87  x3 = grid[KDIR].x;
88 
89  if (side == 0) { /* -- check solution inside domain -- */
90  DOM_LOOP(k,j,i){};
91  }
92 
93  if (side == X1_BEG){ /* -- X1_BEG boundary / Cylinder @ R = R_INT -- */
94  X1_BEG_LOOP(k,j,i){
95  d->Vc[RHO][k][j][i] = d->Vc[RHO][k][j][2*IBEG - i - 1];
96  d->Vc[PRS][k][j][i] = d->Vc[PRS][k][j][2*IBEG - i - 1];
97  d->Vc[VX1][k][j][i] = - d->Vc[VX1][k][j][2*IBEG - i - 1];
98  d->Vc[VX2][k][j][i] = d->Vc[VX2][k][j][2*IBEG - i - 1];
99  d->Vc[VX3][k][j][i] = g_inputParam[OMEGA]*x1[i];
100  }
101  }
102 
103  if (side == X1_END){ /* -- X1_END boundary / Cylinder @ R = R_EXT -- */
104  X1_END_LOOP(k,j,i){
105  d->Vc[RHO][k][j][i] = d->Vc[RHO][k][j][2*IEND - i + 1];
106  d->Vc[PRS][k][j][i] = d->Vc[PRS][k][j][2*IEND - i + 1];
107  d->Vc[VX1][k][j][i] = - d->Vc[VX1][k][j][2*IEND - i + 1];
108  d->Vc[VX2][k][j][i] = d->Vc[VX2][k][j][2*IEND - i + 1];
109  d->Vc[VX3][k][j][i] = 0.0;
110  }
111  }
112 }
113 
#define X1_BEG
Boundary region at X1 beg.
Definition: pluto.h:146
void UserDefBoundary(const Data *d, RBox *box, int side, Grid *grid)
Definition: init.c:98
DOM_LOOP(k, j, i)
Definition: analysis.c:22
#define VX2
Definition: mod_defs.h:29
#define RHO
Definition: mod_defs.h:19
static double *** eta[3]
Definition: res_functions.c:94
double **** Vc
The main four-index data array used for cell-centered primitive variables.
Definition: structs.h:31
#define TRC
Definition: pluto.h:581
#define X1_END
Boundary region at X1 end.
Definition: pluto.h:147
#define VX1
Definition: mod_defs.h:28
#define KDIR
Definition: pluto.h:195
#define IDIR
Definition: pluto.h:193
Definition: structs.h:78
double g_inputParam[32]
Array containing the user-defined parameters.
Definition: globals.h:131
int j
Definition: analysis.c:2
long int IEND
Upper grid index of the computational domain in the the X1 direction for the local processor...
Definition: globals.h:37
int k
Definition: analysis.c:2
double g_domBeg[3]
Lower limits of the computational domain.
Definition: globals.h:125
double * x
Definition: structs.h:80
#define X1_END_LOOP(k, j, i)
Definition: macros.h:50
PLUTO main header file.
#define X1_BEG_LOOP(k, j, i)
Definition: macros.h:46
Definition: structs.h:30
#define OMEGA
int i
Definition: analysis.c:2
#define VX3
Definition: mod_defs.h:30
#define CONST_PI
.
Definition: pluto.h:269
double g_domEnd[3]
Upper limits of the computational domain.
Definition: globals.h:126
#define JDIR
Definition: pluto.h:194
Definition: structs.h:346
long int IBEG
Lower grid index of the computational domain in the the X1 direction for the local processor...
Definition: globals.h:35
void Analysis(const Data *d, Grid *grid)
Definition: init.c:66
void Init(double *v, double x1, double x2, double x3)
Definition: init.c:17