Skip to content

Commit 0215ae5

Browse files
author
bosserellec
committed
Fix single dir
1 parent 9aa80c6 commit 0215ae5

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

Wavestep.cu

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ void CUDA_CHECK(cudaError CUDerr)
1010
write_text_to_log_file("Cuda error in file " + std::string(__FILE__) + " in line " + std::to_string(__LINE__) + " " + std::string(cudaGetErrorString(CUDerr)));
1111

1212
fprintf(stderr, "Cuda error in file '%s' in line %i : %s.\n", __FILE__, __LINE__, cudaGetErrorString(CUDerr));
13-
13+
1414
write_text_to_log_file("Cuda error in file " + std::string(__FILE__) + " in line " + std::to_string(__LINE__) + " " + std::string(cudaGetErrorString(CUDerr)));
1515
exit(EXIT_FAILURE);
1616

@@ -29,7 +29,7 @@ XBGPUParam waveinitGPU(XBGPUParam Param, std::vector<Wavebndparam> wavebnd)
2929
ny = Param.ny;
3030

3131

32-
32+
3333
if (Param.dtheta > 0.0)
3434
{
3535
Param.ntheta = round((Param.thetamax - Param.thetamin) / Param.dtheta);
@@ -43,7 +43,7 @@ XBGPUParam waveinitGPU(XBGPUParam Param, std::vector<Wavebndparam> wavebnd)
4343
Param.dtheta = (Param.thetamax - Param.thetamin) / Param.ntheta;
4444
}
4545

46-
46+
4747
ntheta = Param.ntheta;
4848
dtheta = Param.dtheta;
4949

@@ -60,7 +60,7 @@ XBGPUParam waveinitGPU(XBGPUParam Param, std::vector<Wavebndparam> wavebnd)
6060
{
6161
nwavbnd = ceil(Param.rtlength / Param.dtbc)+1; // +1 needed here
6262
}
63-
63+
6464
theta = (DECNUM *)malloc(ntheta*sizeof(DECNUM));
6565

6666
Stfile = (double *)malloc(ntheta*ny*nwavbnd*sizeof(double));
@@ -122,7 +122,7 @@ XBGPUParam waveinitGPU(XBGPUParam Param, std::vector<Wavebndparam> wavebnd)
122122
{
123123
//readXbbndstep(nx, ny, ntheta, Param.wavebndfile.c_str(), 1, Trepold, qfile, Stfile);
124124
readXbbndstep(Param, wavebnd, 0, Trep, qfile, Stfile);
125-
125+
126126
}
127127
if (Param.wavebndtype == 3)
128128
{
@@ -327,7 +327,7 @@ XBGPUParam waveinitGPU(XBGPUParam Param, std::vector<Wavebndparam> wavebnd)
327327

328328
//Clac Stat
329329

330-
330+
331331
for (int i = 0; i < ntheta; i++) //! Fill St
332332
{
333333
//St[i]=Stold[i];
@@ -375,7 +375,7 @@ XBGPUParam waveinitGPU(XBGPUParam Param, std::vector<Wavebndparam> wavebnd)
375375
}
376376

377377

378-
//run dispersion relation
378+
//run dispersion relation
379379

380380
return Param;
381381

@@ -521,17 +521,17 @@ void wavebnd(XBGPUParam Param, std::vector<Wavebndparam> wavebndvec)
521521

522522
double difft = wavebndvec[WAVstepinbnd].time - totaltime;
523523

524-
524+
525525
if (difft < 0.0)
526526
{
527527
WAVstepinbnd++;
528528

529-
529+
530530
if (Param.wavebndtype == 2)
531531
{
532532
//Read new STfile and qfile XBeach style
533533
readXbbndstep(Param, wavebndvec, WAVstepinbnd - 1, Trep, qfile, Stfile);
534-
534+
535535
}
536536

537537
if (Param.wavebndtype == 3)
@@ -551,7 +551,7 @@ void wavebnd(XBGPUParam Param, std::vector<Wavebndparam> wavebndvec)
551551
int nfHR, ndHR;
552552

553553
makjonswap(Param, wavebndvec, WAVstepinbnd - 1, nfHR, ndHR, HRfreq, HRdir, HRSpec);
554-
554+
555555
//Then generate wave group timeseries based on that spectra
556556
//void GenWGnLBW(XBGPUParam Param, int nf, int ndir, double * HRfreq, double * HRdir, double * HRSpec, float Trep, double * qfile, double * Stfile)
557557
GenWGnLBW(Param, nfHR, ndHR, HRfreq, HRdir, HRSpec, Trep, qfile, Stfile);
@@ -741,7 +741,7 @@ void wavebnd(XBGPUParam Param, std::vector<Wavebndparam> wavebndvec)
741741
{
742742
St[ni + i*ny] = interptime(Stnew[ni + i*ny], Stold[ni + i*ny], timenext, timesincelast);
743743
}
744-
744+
745745
}
746746

747747
if (Param.flow == 1)
@@ -879,13 +879,15 @@ void wavestep(XBGPUParam Param)
879879
CUDA_CHECK(cudaMalloc((void **)&yadvec_g, nx*ny*ntheta*sizeof(DECNUM)));
880880
CUDA_CHECK(cudaMalloc((void **)&thetaadvec_g, nx*ny*ntheta*sizeof(DECNUM)));
881881

882-
xadvecupwind2 << <gridDim, blockDim, 0 >> >(nx, ny, ntheta, Param.dtheta, Param.dx, dt, wci_g, ee_g, cg_g, cxsth_g, uu_g, xadvec_g);
882+
//xadvecupwind2 << <gridDim, blockDim, 0 >> >(nx, ny, ntheta, Param.dtheta, Param.dx, dt, wci_g, ee_g, cg_g, cxsth_g, uu_g, xadvec_g);
883+
xadvecupwind2SD << <gridDim, blockDim, 0 >> >(nx, ny, ntheta, Param.dtheta, Param.dx, dt, thetamean_g, wci_g, ee_g, cg_g, cxsth_g, uu_g, xadvec_g);
883884
//CUT_CHECK_ERROR("eulerupwind xadvec execution failed\n");
884885
CUDA_CHECK(cudaThreadSynchronize());
885886

886887

887888

888-
yadvecupwind2 << <gridDim, blockDim, 0 >> >(nx, ny, ntheta, Param.dtheta, Param.dx, dt, wci_g, ee_g, cg_g, sxnth_g, vv_g, yadvec_g);
889+
//yadvecupwind2 << <gridDim, blockDim, 0 >> >(nx, ny, ntheta, Param.dtheta, Param.dx, dt, wci_g, ee_g, cg_g, sxnth_g, vv_g, yadvec_g);
890+
yadvecupwind2SD << <gridDim, blockDim, 0 >> >(nx, ny, ntheta, Param.dtheta, Param.dx, dt, thetamean_g, wci_g, ee_g, cg_g, sxnth_g, vv_g, yadvec_g);
889891
//CUT_CHECK_ERROR("eulerupwind yadvec execution failed\n");
890892
CUDA_CHECK(cudaThreadSynchronize());
891893

@@ -978,7 +980,7 @@ void wavestep(XBGPUParam Param)
978980

979981

980982

981-
//
983+
//
982984
// Total dissipation from breaking and bottom friction
983985
//
984986

@@ -1017,7 +1019,7 @@ void wavestep(XBGPUParam Param)
10171019

10181020
//thetaadvecuw<<<gridDim, blockDim, 0>>>(nx,ny,ntheta,dtheta,eect_g,thetaadvec_g);
10191021
////CUT_CHECK_ERROR("eulerupwind thetaadvecuw execution failed\n");
1020-
//CUDA_CHECK( cudaThreadSynchronize() );
1022+
//CUDA_CHECK( cudaThreadSynchronize() );
10211023

10221024
thetaadvecuw2ho << <gridDim, blockDim, 0 >> >(nx, ny, ntheta, Param.dtheta, Param.dx, dt, Param.wci, rr_g, ctheta_g, thetaadvec_g);
10231025
//CUT_CHECK_ERROR("eulerupwind thetaadvec execution failed\n");
@@ -1044,9 +1046,9 @@ void wavestep(XBGPUParam Param)
10441046
//CUDA_CHECK( cudaMemcpy(D_g, uu, nx*ny*sizeof(DECNUM ), cudaMemcpyHostToDevice) );
10451047

10461048

1047-
//
1049+
//
10481050
// Distribution of dissipation over directions and frequencies
1049-
//
1051+
//
10501052
dissipation << <gridDim, blockDim, 0 >> >(nx, ny, ntheta, Param.dtheta, Param.eps, dt, Param.g, Param.beta, wci_g, hh_g, ee_g, D_g, E_g, rr_g, c_g, cxsth_g, sxnth_g, uu_g, vv_g, DR_g, R_g);
10511053
//CUT_CHECK_ERROR("dissipation execution failed\n");
10521054
CUDA_CHECK(cudaThreadSynchronize());
@@ -1062,9 +1064,9 @@ void wavestep(XBGPUParam Param)
10621064

10631065

10641066

1065-
//
1067+
//
10661068
// Compute mean wave direction
1067-
//
1069+
//
10681070

10691071
meandir << <gridDim, blockDim, 0 >> >(nx, ny, ntheta, Param.rho, Param.g, Param.dtheta, ee_g, theta_g, thetamean_g, E_g, H_g);
10701072
//CUT_CHECK_ERROR("meandir execution failed\n");
@@ -1095,7 +1097,7 @@ void wavestep(XBGPUParam Param)
10951097
//CUT_CHECK_ERROR("radstress execution failed\n");
10961098
CUDA_CHECK(cudaThreadSynchronize());
10971099

1098-
//
1100+
//
10991101
// Wave forces
11001102
//
11011103
wavforce << <gridDim, blockDim, 0 >> >(nx, ny, ntheta, Param.dx, Param.dtheta, Sxx_g, Sxy_g, Syy_g, Fx_g, Fy_g, hh_g);

0 commit comments

Comments
 (0)