Snoopy Version 6.0 (Albert)
common.h
Go to the documentation of this file.
00001 /*      
00002         This file is part of the Snoopy code.
00003 
00004     Snoopy code is free software: you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation, either version 3 of the License, or
00007     (at your option) any later version.
00008 
00009     Snoopy code is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.
00013 
00014     You should have received a copy of the GNU General Public License
00015     along with Snoopy code.  If not, see <http://www.gnu.org/licenses/>.
00016 */
00017 
00018 
00019 
00020 #include "snoopy.h"
00021 
00022 #define         CHECK_NAN(XIN)          c_nan(XIN, __func__, __LINE__,__FILE__)
00023  
00024 // All these variables may be used in the code as they are initialized by common.c
00025 // Wave number pointers
00026 extern double   *kx,    *ky,    *kz,    *kxt,   *k2t,   *ik2t;
00027 extern double   kxmax,  kymax,  kzmax,  kmax;
00028 
00029 
00030 // Mask for dealiasing
00031 extern double   *mask;
00032 
00033 extern double   *wr1,   *wr2,   *wr3;
00034 extern double   *wr4,   *wr5,   *wr6;
00035 extern double   *wr7,   *wr8,   *wr9;
00036 extern double   *wr10,  *wr11,  *wr12;
00037 extern double   *wr13,  *wr14,  *wr15;
00038 
00039 extern double complex           *w1,    *w2,    *w3;
00040 extern double complex           *w4,    *w5,    *w6;
00041 extern double complex           *w7,    *w8,    *w9;
00042 extern double complex           *w10,   *w11,   *w12;
00043 extern double complex           *w13,   *w14,   *w15;
00044 
00045 
00046 // Parameters
00047 extern struct Parameters                        param;
00048 
00049 // Physics variables 
00050 extern double   nu;
00051 
00052 #ifdef BOUSSINESQ
00053 extern double   nu_th;
00054 #ifdef N2PROFILE
00055 extern double *N2_profile;
00056 #endif
00057 #endif
00058 
00059 #ifdef MHD
00060 extern double   eta;
00061 #endif
00062 
00063 // MPI
00064 #ifdef MPI_SUPPORT
00065 extern int              NPROC;                                                                  
00066 #endif
00067 extern int rank;
00068 
00069 // OpenMP
00070 extern int      nthreads;
00071 
00072 // Functions provided by the common routine
00073 
00074 void init_common ( void );
00075 void finish_common ( void );
00076 void allocate_field(struct Field *fldi);
00077 void deallocate_field(struct Field *fldi);
00078 double get_c_time(void);
00079 
00080 // Useful only if MPI is active. Can be called without though...
00081 void reduce(double *var, const int op);
00082 
00083 float big_endian(float in_number);
00084 
00085 double randm_normal(void);
00086 double randm (void);
00087 
00088 void projector( double complex qx[],
00089                             double complex qy[],
00090                             double complex qz[]);
00091                                 
00092 double energy(const double complex q[]);
00093 
00094 #ifdef COMPRESSIBLE
00095 void check_positivity(double *wri);
00096 #endif
00097