Skip to content

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed
 

‎src/Mainloop.cu

+7-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ template <class T> void MainLoop(Param &XParam, Forcing<float> XForcing, Model<T
3636

3737
// Time keeping
3838
XLoop.totaltime = XLoop.totaltime + XLoop.dt;
39-
log("timestep = " + std::to_string(XLoop.totaltime));
39+
//log("timestep = " + std::to_string(XLoop.totaltime));
4040

4141
// Apply tsunami deformation if any (this needs to happen after totaltime has been incremented)
4242
deformstep(XParam, XLoop, XForcing.deform, XModel, XModel_g);
@@ -384,7 +384,12 @@ template <class T> __host__ double initdt(Param XParam, Loop<T> XLoop, Model<T>
384384
{
385385
XLoop.dtmax = XParam.dtinit / 1.5;
386386
}
387-
387+
else
388+
{
389+
// WARNING here we specify at least an initial time step if there was 10.0m of water at the highest resolution cell.
390+
// The modle will recalculate the optimal dt in subsequent step;
391+
XLoop.dtmax = calcres(XParam.dx, XParam.maxlevel) / (sqrt(XParam.g * 10.0));
392+
}
388393
BlockP<T> XBlock = XModel.blocks;
389394

390395
/*

‎src/ReadForcing.cu

+11-2
Original file line numberDiff line numberDiff line change
@@ -1388,6 +1388,8 @@ void readbathyASCHead(std::string filename, int &nx, int &ny, double &dx, double
13881388
//std::getline(fs, line);
13891389
int linehead = 0;
13901390

1391+
bool pixelreg = true;
1392+
13911393
while (linehead < 6)
13921394
{
13931395
std::getline(fs, line);
@@ -1441,15 +1443,15 @@ void readbathyASCHead(std::string filename, int &nx, int &ny, double &dx, double
14411443
}
14421444
if (left.compare("yllcenter") == 0) // found the parameter
14431445
{
1444-
1446+
pixelreg = false;
14451447
//
14461448
yo = std::stod(right);
14471449

14481450
}
14491451
//if gridnode registration this should happen
14501452
if (left.compare("xllcorner") == 0) // found the parameter
14511453
{
1452-
1454+
pixelreg = false;
14531455
//
14541456
xo = std::stod(right);
14551457

@@ -1467,6 +1469,13 @@ void readbathyASCHead(std::string filename, int &nx, int &ny, double &dx, double
14671469
linehead++;
14681470
}
14691471
}
1472+
1473+
if (!pixelreg)
1474+
{
1475+
xo = xo + 0.5 * dx;
1476+
yo = yo + 0.5 * dx;
1477+
}
1478+
14701479
grdalpha = 0.0;
14711480
fs.close();
14721481

0 commit comments

Comments
 (0)
Please sign in to comment.