easywave.h 3.21 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
/*
 * EasyWave - A realtime tsunami simulation program with GPU support.
 * Copyright (C) 2014  Andrey Babeyko, Johannes Spazier
 * GFZ German Research Centre for Geosciences (http://www.gfz-potsdam.de)
 *
 * Parts of this program (especially the GPU extension) were developed
 * within the context of the following publicly funded project:
 * - TRIDEC, EU 7th Framework Programme, Grant Agreement 258723
 *   (http://www.tridec-online.eu)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
#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)

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

int ewLoadBathymetry();
int ewParam( int argc, char **argv );
void ewLogParams(void);
int ewReset();
int ewSource();
int ewStep();
int ewStepCor();

int setWaveHeights();

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 */