PLUTO
flat_states.c
Go to the documentation of this file.
1 #include "pluto.h"
2 
3 /* ************************************************************* */
4 void States (const State_1D *state, int beg, int end, Grid *grid)
5 /*
6  * PURPOSE
7  *
8  * provide 1st order flat reconstruction inside each
9  * cell.
10  * Here vL and vR are left and right states with respect
11  * to the cell interface, while vm and vp refer to the cell
12  * center, that is:
13  *
14  * VL-> <-VR
15  * |--------*--------|--------*--------|
16  * <-am (i) ap-> (i+1)
17  *
18  *
19  **************************************************************** */
20 {
21  int nv, i;
22 
23  #if TIME_STEPPING != EULER
24  #error FLAT Reconstruction must be used with EULER integration only
25  #endif
26 
27  for (i = beg; i <= end; i++) {
28  for (nv = 0; nv < NVAR; nv++) {
29  state->vm[i][nv] = state->vp[i][nv] = state->v[i][nv];
30  }}
31  PrimToCons(state->vm, state->um, beg, end);
32  PrimToCons(state->vp, state->up, beg, end);
33 
34 /* -------------------------------------------
35  Assign face-centered magnetic field
36  ------------------------------------------- */
37 
38  #ifdef STAGGERED_MHD
39  for (i = beg; i <= end-1; i++) {
40  state->vR[i][BXn] = state->vL[i][BXn] = state->bn[i];
41  }
42  #endif
43 
44 /* -------------------------------------------
45  compute states in conservative variables
46  ------------------------------------------- */
47 
48  PrimToCons (state->vp, state->up, beg, end);
49  PrimToCons (state->vm, state->um, beg, end);
50 }
double ** v
Cell-centered primitive varables at the base time level, v[i] = .
Definition: structs.h:134
int end
Global end index for the local array.
Definition: structs.h:116
double ** vR
Primitive variables to the right of the interface, .
Definition: structs.h:139
int BXn
Definition: globals.h:75
double ** vp
prim vars at i+1/2 edge, vp[i] = vL(i+1/2)
Definition: structs.h:142
int beg
Global start index for the local array.
Definition: structs.h:115
Definition: structs.h:78
void States(const State_1D *state, int beg, int end, Grid *grid)
Definition: flat_states.c:4
double ** vm
prim vars at i-1/2 edge, vm[i] = vR(i-1/2)
Definition: structs.h:141
PLUTO main header file.
void PrimToCons(double **uprim, double **ucons, int ibeg, int iend)
Definition: mappers.c:26
int i
Definition: analysis.c:2
double * bn
Face magentic field, bn = bx(i+1/2)
Definition: structs.h:165
double ** um
same as vm, in conservative vars
Definition: structs.h:146
double ** vL
Primitive variables to the left of the interface, .
Definition: structs.h:136
double ** up
same as vp, in conservative vars
Definition: structs.h:147
#define NVAR
Definition: pluto.h:609