36 #if GEOMETRY != SPHERICAL
43 static int first_call = 1;
44 double *x1, *x2, *x3, th, w;
51 #if GEOMETRY == CARTESIAN || GEOMETRY == POLAR
69 #if GEOMETRY == CARTESIAN
75 #if FARGO_AVERAGE_VELOCITY == YES
83 double w_recv=0.0, w_sum=0.0;
84 int count, coords[3], src, dst;
97 for (i = 0; i <
DIMENSIONS; i++) coords[i] = grid[i].rank_coord;
99 MPI_Cart_rank(cartcomm, coords, &dst);
101 for (i = 0; i <
DIMENSIONS; i++) coords[i] = grid[i].rank_coord;
103 MPI_Cart_rank(cartcomm, coords, &src);
108 #if GEOMETRY == CARTESIAN || GEOMETRY == POLAR
115 if (grid[
SDIR].nproc > 1){
118 for (count=1; count < grid[
SDIR].
nproc; count++ ){
119 MPI_Sendrecv(&w, 1, MPI_DOUBLE, dst, 0, &w_recv, 1,
120 MPI_DOUBLE, src, 0, cartcomm, &status);
124 w = w_sum/(double)(grid[
SDIR].np_int_glob);
129 #if GEOMETRY == CARTESIAN || GEOMETRY == POLAR
131 #elif GEOMETRY == SPHERICAL
166 #if GEOMETRY == CARTESIAN
168 #elif GEOMETRY == POLAR
170 #elif GEOMETRY == SPHERICAL
176 print1 (
"! FARGO not supported in this geometry\n");
202 #if GEOMETRY == CARTESIAN
213 #if GEOMETRY == CARTESIAN || GEOMETRY == POLAR
215 #elif GEOMETRY == SPHERICAL
218 print1 (
"! FARGO not supported in this geometry\n");
223 vphi_is_total_velocity =
NO;
240 #if GEOMETRY == CARTESIAN
247 #if GEOMETRY == CARTESIAN || GEOMETRY == POLAR
249 #elif GEOMETRY == SPHERICAL
252 print1 (
"! FARGO not supported in this geometry\n");
257 vphi_is_total_velocity =
YES;
void Boundary(const Data *d, int idim, Grid *grid)
void print1(const char *fmt,...)
double ** FARGO_GetVelocity(void)
long int NX2_TOT
Total number of zones in the X2 direction (boundaries included) for the local processor.
double **** Vc
The main four-index data array used for cell-centered primitive variables.
static int vphi_is_total_velocity
int AL_Get_cart_comm(int, MPI_Comm *)
#define FARGO_NSTEP_AVERAGE
long int g_stepNumber
Gives the current integration step number.
#define TOT_LOOP(k, j, i)
long int NX3_TOT
Total number of zones in the X3 direction (boundaries included) for the local processor.
void FARGO_ComputeVelocity(const Data *d, Grid *grid)
void FARGO_AddVelocity(const Data *d, Grid *grid)
int FARGO_HasTotalVelocity()
#define ARRAY_2D(nx, ny, type)
#define QUIT_PLUTO(e_code)
double FARGO_SetVelocity(double, double)
long int NX1_TOT
Total number of zones in the X1 direction (boundaries included) for the local processor.
int nproc
number of processors for this grid.
void FARGO_SubtractVelocity(const Data *d, Grid *grid)