From 05a1f4df10eaa4af355d652ab79e964a65947035 Mon Sep 17 00:00:00 2001 From: Cyprien Bosserelle Date: Fri, 9 Mar 2018 16:08:13 +1300 Subject: [PATCH] Fixed bug --- Flow_kernel.cu | 4 ++-- Wave_gpu.cu | 3 +++ read_input.cpp | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Flow_kernel.cu b/Flow_kernel.cu index ebc9ef6..a93dc20 100644 --- a/Flow_kernel.cu +++ b/Flow_kernel.cu @@ -178,7 +178,7 @@ __global__ void ubnd1D(int nx, int ny, DECNUM dx, DECNUM dt, DECNUM g, DECNUM rh unsigned int yminus = mminus(iy, ny); unsigned int yplus = pplus(iy, ny); - DECNUM zsbnd = zsbndi + (zsbndn - zsbndi)*(iy / ny); + DECNUM zsbnd = zsbndi + (zsbndn - zsbndi)*(((float)iy) / ((float)ny)); DECNUM ui, vi, thetai, vert; DECNUM ht, htr; @@ -343,7 +343,7 @@ __global__ void ubnd1Dnowaves(int nx, int ny, DECNUM dx, DECNUM dt, DECNUM g, DE unsigned int yminus = mminus(iy, ny); unsigned int yplus = pplus(iy, ny); - DECNUM zsbnd = zsbndi + (zsbndn - zsbndi)*(iy / ny); + DECNUM zsbnd = zsbndi + (zsbndn - zsbndi)*(((float)iy) / ((float)ny));; DECNUM ui, vi, thetai, vert; DECNUM ht, htr; diff --git a/Wave_gpu.cu b/Wave_gpu.cu index 381bf7f..9404813 100644 --- a/Wave_gpu.cu +++ b/Wave_gpu.cu @@ -1042,6 +1042,9 @@ void flowbnd(XBGPUParam Param, std::vector slbnd, std::vector wn zsbndi = interptime(slbnd[SLstepinbnd].wlev0, slbnd[SLstepinbnd - 1].wlev0, slbnd[SLstepinbnd].time - slbnd[SLstepinbnd - 1].time, totaltime - slbnd[SLstepinbnd - 1].time); zsbndn = interptime(slbnd[SLstepinbnd].wlev1, slbnd[SLstepinbnd - 1].wlev1, slbnd[SLstepinbnd].time - slbnd[SLstepinbnd - 1].time, totaltime - slbnd[SLstepinbnd - 1].time); + //printf("Wlev1=%f\n ", zsbndn); + + if (Param.wavebndtype == 1) { timenext = wavebndvec[WAVstepinbnd].time - wavebndvec[WAVstepinbnd - 1].time; diff --git a/read_input.cpp b/read_input.cpp index a0c0ff5..33cdfe2 100644 --- a/read_input.cpp +++ b/read_input.cpp @@ -312,6 +312,7 @@ std::vector readWLfile(std::string WLfilename) if (lineelements.size() > 2) { slbndline.wlev1 = std::stod(lineelements[2]); + //printf("Wlev1=%f\n ", slbndline.wlev1); } //slbndline = readBSHline(line);