PLUTO
emf_userdef.c
Go to the documentation of this file.
1 #include "pluto.h"
2 
3 /* ************************************************************** */
4 void EMF_USERDEF_BOUNDARY (EMF *emf, int side, int loc, Grid *grid)
5 /*
6  *
7  *
8  * PURPOSE:
9  *
10  * Set boundary conditions on electric field.
11  * Quantities are evaluated at zone face, NOT edge.
12  *
13  * The electric field components are given by
14  * the fluxes of the induction equation:
15  *
16  * +----+
17  * | 0 |
18  * |-Ezi| at x - faces
19  * | Eyi|
20  * +----+
21  *
22  * +----+
23  * | Ezj|
24  * | 0 | at y - faces
25  * |-Exj|
26  * +----+
27  *
28  * +----+
29  * |-Eyk|
30  * | Exk| at z - faces
31  * | 0 |
32  * +----+
33  *
34  * Only the components required to update the normal megnetic
35  * field are required.
36  * For example, at the lower x-boundary, the necessary
37  * electric field components to update bx are Ez and Ey (no Ex).
38  * Thus one needs to specify
39  *
40  * Ez at y-faces (ezj)
41  * Ey at z-faces (eyk)
42  *
43  *
44  * LAST MODIFIED:
45  *
46  * February 21 2008 by A. Mignone (email:mignone@to.astro.it)
47  *
48  *
49  *
50  *
51  **************************************************************** */
52 {
53  int i, j, k;
54 
55  return; /* !! comment this line if you intend to use this function !! */
56 
57  if (loc != FACE_EMF) return;
58 
59  if (side == X1_BEG) {
60 
61  X1_BEG_LOOP(k,j,i){
62  D_EXPAND( ,
63  emf->ezj[k][j][i] = emf->ezj[k][j][IBEG]; ,
64  emf->eyk[k][j][i] = emf->eyk[k][j][IBEG];
65  )
66  }
67 
68  }else if (side == X1_END){
69 
70  X1_END_LOOP(k,j,i){
71  D_EXPAND( ,
72  emf->ezj[k][j][i] = emf->ezj[k][j][IEND]; ,
73  emf->eyk[k][j][i] = emf->eyk[k][j][IEND];
74  )
75  }
76 
77  }else if (side == X2_BEG){
78 
79  X2_BEG_LOOP(k,j,i){
80  D_EXPAND( ,
81  emf->ezi[k][j][i] = emf->ezi[k][JBEG][i]; ,
82  emf->exk[k][j][i] = emf->exk[k][JBEG][i];
83  )
84  }
85 
86  }else if (side == X2_END){
87 
88  X2_END_LOOP(k,j,i){
89  D_EXPAND( ,
90  emf->ezi[k][j][i] = emf->ezi[k][JEND][i]; ,
91  emf->exk[k][j][i] = emf->exk[k][JEND][i];
92  )
93  }
94 
95  }else if (side == X3_BEG){
96 
97  X3_BEG_LOOP(k,j,i){
98  emf->exj[k][j][i] = emf->exj[KBEG][j][i];
99  emf->eyi[k][j][i] = emf->eyi[KBEG][j][i];
100  }
101 
102  }else if (side == X3_END){
103 
104  X3_END_LOOP(k,j,i){
105  emf->exj[k][j][i] = emf->exj[KEND][j][i];
106  emf->eyi[k][j][i] = emf->eyi[KEND][j][i];
107  }
108 
109  }
110 }
111 
112 
#define X3_BEG
Boundary region at X3 beg.
Definition: pluto.h:150
#define X1_BEG
Boundary region at X1 beg.
Definition: pluto.h:146
static EMF emf
Definition: ct_emf.c:27
#define X3_END_LOOP(k, j, i)
Definition: macros.h:52
#define X1_END
Boundary region at X1 end.
Definition: pluto.h:147
#define X2_BEG_LOOP(k, j, i)
Definition: macros.h:47
void EMF_USERDEF_BOUNDARY(EMF *emf, int side, int loc, Grid *grid)
Definition: emf_userdef.c:4
double *** ezi
Ez available at x-faces (i+1/2);.
Definition: ct.h:79
#define X2_END_LOOP(k, j, i)
Definition: macros.h:51
double *** exk
Ex available at z-faces (k+1/2);.
Definition: ct.h:76
#define X2_END
Boundary region at X2 end.
Definition: pluto.h:149
Definition: structs.h:78
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
#define X1_END_LOOP(k, j, i)
Definition: macros.h:50
#define X3_END
Boundary region at X3 end.
Definition: pluto.h:151
PLUTO main header file.
double *** eyi
Ey available at x-faces (i+1/2);.
Definition: ct.h:77
D_EXPAND(tot/[n]=(double) grid[IDIR].np_int_glob;, tot/[n]=(double) grid[JDIR].np_int_glob;, tot/[n]=(double) grid[KDIR].np_int_glob;)
Definition: analysis.c:27
double *** eyk
Ey available at z-faces (k+1/2);.
Definition: ct.h:78
#define X1_BEG_LOOP(k, j, i)
Definition: macros.h:46
int i
Definition: analysis.c:2
double *** ezj
Ez available at y-faces (j+1/2);.
Definition: ct.h:80
#define FACE_EMF
Definition: ct.h:38
long int KBEG
Lower grid index of the computational domain in the the X3 direction for the local processor...
Definition: globals.h:43
#define X2_BEG
Boundary region at X2 beg.
Definition: pluto.h:148
long int KEND
Upper grid index of the computational domain in the the X3 direction for the local processor...
Definition: globals.h:45
long int JBEG
Lower grid index of the computational domain in the the X2 direction for the local processor...
Definition: globals.h:39
double *** exj
Ex available at y-faces (j+1/2);.
Definition: ct.h:75
long int JEND
Upper grid index of the computational domain in the the X2 direction for the local processor...
Definition: globals.h:41
#define X3_BEG_LOOP(k, j, i)
Definition: macros.h:48
long int IBEG
Lower grid index of the computational domain in the the X1 direction for the local processor...
Definition: globals.h:35