void sciddicaT_simulation_init(struct CALModel2D* sciddicaT) { CALreal z, h; CALint i, j; //sciddicaT parameters setting P.r = P_R; P.epsilon = P_EPSILON; //sciddicaT source initialization for (i=0; i<sciddicaT->rows; i++) for (j=0; j<sciddicaT->columns; j++) { h = calGet2Dr(sciddicaT, Q.h, i, j); if ( h > 0.0 ) { z = calGet2Dr(sciddicaT, Q.z, i, j); calSetCurrent2Dr(sciddicaT, Q.z, i, j, z-h); #ifdef ACTIVE_CELLS //adds the cell (i, j) to the set of active ones calAddActiveCell2D(sciddicaT, i, j); #endif } } }
void doErosion(struct CALModel2D* s3hex, int i, int j, CALreal erosion_depth) { CALreal z, d, h, p, runup; z = calGet2Dr(s3hex,Q.z,i,j); d = calGet2Dr(s3hex,Q.d,i,j); h = calGet2Dr(s3hex,Q.h,i,j); p = calGet2Dr(s3hex,Q.p,i,j); if (h > 0) runup = p/h + erosion_depth; else runup = erosion_depth; calSetCurrent2Dr(s3hex,Q.z,i,j, (z - erosion_depth)); calSetCurrent2Dr(s3hex,Q.d,i,j, (d - erosion_depth)); calSet2Dr(s3hex,Q.h,i,j, (h + erosion_depth)); calSet2Dr(s3hex,Q.p,i,j, (h + erosion_depth)*runup); }