Skip to content

Commit

Permalink
fixes for gaussian topog type option (#340)
Browse files Browse the repository at this point in the history
* set uninitialized value in create_gaussian_topog

* fix wrong variable in loop

* fix loop variable again

---------

Co-authored-by: rem1776 <[email protected]>
  • Loading branch information
rem1776 and rem1776 authored Jan 23, 2025
1 parent 92c085d commit f892fc4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tools/make_topog/topog.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ void create_gaussian_topog(int nx, int ny, const double *x, const double *y, dou
double bump_height, bump_scale, xcent, ycent, arg, bottom;
double xe, xw, ys, yn;
double *xt, *yt;
int i, j, nxp, nyp;
int i, j, nxp;

nxp = nx + 1;

xt = (double *)malloc(nx*ny*sizeof(double));
yt = (double *)malloc(nx*ny*sizeof(double));
Expand Down Expand Up @@ -142,7 +144,7 @@ void create_gaussian_topog(int nx, int ny, const double *x, const double *y, dou
printf("The ocean floor rises with a slope of %f meters/deg towards the east and %f "
" meters/deg to the north.", slope_x, slope_y) ;

for(j=0;i<nx*ny;j++){
for(i=0;i<nx*ny;i++){
arg = pow(xt[i]-xcent,2) + pow(yt[i]-ycent,2);
bottom = bottom_depth - bump_height*exp(-arg/pow(bump_scale,2));
bottom = bottom - slope_x*(xt[i]-xw)- slope_y*(yt[i]-ys);
Expand Down

0 comments on commit f892fc4

Please sign in to comment.