easywave.h 2.22 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
#ifndef EASYWAVE_H
#define EASYWAVE_H

#define Re 6384.e+3          // Earth radius
#define Gravity 9.81         // gravity acceleration
#define Omega 7.29e-5        // Earth rotation period [1/sec]

#define MAX_VARS_PER_NODE 12

#define iD    0
#define iH    1
#define iHmax 2
#define iM    3
#define iN    4
#define iR1   5
#define iR2   6
#define iR3   7
#define iR4   8
#define iR5   9
#define iTime 10
#define iTopo 11

// Global data
struct EWPARAMS {
  char *modelName;
  char *modelSubset;
  char *fileBathymetry;
  char *fileSource;
  char *filePOIs;
  int dt;
  int time;
  int timeMax;
  int poiDt;
  int poiReport;
  int outDump;
  int outProgress;
  int outPropagation;
  int coriolis;
  float dmin;
  float poiDistMax;
  float poiDepthMin;
  float poiDepthMax;
  float ssh0ThresholdRel;
  float ssh0ThresholdAbs;
  float sshClipThreshold;
  float sshZeroThreshold;
  float sshTransparencyThreshold;
  float sshArrivalThreshold;
  bool gpu;
  bool adjustZtop;
  bool verbose;
};

extern struct EWPARAMS Par;
extern int NLon,NLat;
extern double LonMin,LonMax,LatMin,LatMax;
extern double DLon,DLat;                 // steps in grad
extern double Dx,Dy;                     // steps in m, dx must be multiplied by cos(y) before use
extern float *R6;
extern float *C1;
extern float *C2;
extern float *C3;
extern float *C4;
extern int Imin;
extern int Imax;
extern int Jmin;
extern int Jmax;

#define idx(j,i) ((i-1)*NLat+j-1)
#define getLon(i) (LonMin+(i-1)*DLon)
#define getLat(j) (LatMin+(j-1)*DLat)

73 74 75
#define getI(lon) round( ( (lon-LonMin) / DLon) )
#define getJ(lat) round( ( (lat-LatMin) / DLat) )

76 77 78 79 80 81 82 83
int ewLoadBathymetry();
int ewParam( int argc, char **argv );
void ewLogParams(void);
int ewReset();
int ewSource();
int ewStep();
int ewStepCor();

84 85
int setWaveHeights();

86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
int ewStart2DOutput();
int ewOut2D();
int ewDump2D();
int ewLoadPOIs();
int ewSavePOIs();
int ewDumpPOIs();
int ewDumpPOIsCompact( int istage );

extern int NPOIs;
extern long *idxPOI;

/* verbose printf: only executed if -verbose was set */
#define printf_v( Args, ... )	if( Par.verbose ) printf( Args, ##__VA_ARGS__);

#include "ewNode.h"

extern CNode *gNode;

#endif /* EASYWAVE_H */