#include #include #include #include /*********************Description******************** The integration of forced Kelvin wave and reflected Rossby waves along the wave characteristic paths. The reflection is based on Cane and Sarachik (1981) that meridionally integrated zonal transport is zero. The code is not well written, but I try to document it well-:) ******************************************************/ /* NOTE: Now totalGrids is 70, from 144e-78w */ #define Boolean {True = 1; False = 0} #define dt 86400 /* seconds a day */ #define climSteps 365*86400/dt /* always assume 365 days a year */ #define totalSteps 5020*86400/dt /* the number of days in this run */ #define const 0.0000000003675 /* RHOair*drag/D */ #define drag0 1./(12.*2635200.) /* month number of drag friction. NOTE: this actually is damping */ #define initStep -9999 #define maxVerModes 8 #define totalGrids 70 /* total zonal grid points */ #define dx 220000.0 /* grid size */ float C[maxVerModes]= {2.73, 1.74, 1.06, 0.76, 0.59, 0.50, 0.42, 0.37}; float Chi[maxVerModes] = {4.29, 3.90, 1.70, 1.25, 1.83, 2.20, 1.57, 1.38}; /*never designed this. My original purpose is to adjust Cg with latitudes.*/ float phaseSpeed() {} /*find effective timestep along the characteric path. Since seasonal cycle is cyclic, adding 12 months if the effective timestep becomes negative */ int effectMomentClim(float end, float origin, int currentStep, float cc) { int steps, effectStep; steps = (int) (end - origin)/(dt*cc); /* printf("%10.0f%10.0f%4d \n", end, origin, steps); */ effectStep = currentStep - steps; while (effectStep < 0) effectStep = climSteps + effectStep; return effectStep; } /*find effective timestep along the characteric path for whole time series. seasonal cycle is used to initialize a run. That is, add 12 months to the effective timestep if it becomes negative */ int effectMoment(float end, float origin, int currentStep, float cc) { int steps, effectStep; steps = (int) (end - origin)/(dt*cc); /* printf("%10.0f%10.0f%4d \n", end, origin, steps); */ effectStep = currentStep - steps; /* if the wave message has not got the current location, effect should be none, so set effectStep = -9999 */ if (effectStep < 0) effectStep = initStep; return effectStep; } /* Actual integration along the path for whole time series*/ void integral(FILE *ofp, int ii, float tauxc[totalGrids][climSteps], float taux[totalGrids][totalSteps], float eastbound[totalSteps]) { int i, k, l, effectStep; float drag, response, damp; /* dumping depends on vertical modes based on McCreary (1981)*/ drag = drag0*(C[0]/C[ii])*(C[0]/C[ii]); k = 0; while (k < totalSteps) { /*look at every zonal grid */ for (i=0; i