From b435bf1d67dd972c1fc8c14b503883b97bb29a4c Mon Sep 17 00:00:00 2001 From: Cyprien Date: Fri, 7 Feb 2020 09:35:35 +1300 Subject: [PATCH] added cf capability --- Wave_gpu.cu | 38 +++++++++++++++++++++++++++++++------- XBeachGPU.h | 4 +++- read_input.cpp | 8 ++++++++ 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/Wave_gpu.cu b/Wave_gpu.cu index 67f3b58..c944f71 100644 --- a/Wave_gpu.cu +++ b/Wave_gpu.cu @@ -2020,13 +2020,38 @@ int main(int argc, char **argv) printf("...done\n"); write_text_to_log_file("...done"); + //// read cf map file + + + if (!XParam.cfmap.empty()) + { + printf("cfmap file found\n"); + write_text_to_log_file("cfmap file found"); + int STnx, STny; + double STdx, STgrdalpha; + readbathyHead(XParam.cfmap, STnx, STny, STdx, STgrdalpha); + + if (STnx != nx || STny != ny) + { + printf("Error cfmap dimension mismatch. Model will run with constant cf.\n"); + write_text_to_log_file("ERROR: Scfmap dimension mismatch. Model will run with constant cf."); + } + else + { + readbathy(XParam.cfmap, cfm); + } + + + + } + //// read Hard layer file if (!XParam.SedThkfile.empty()) { - printf("Hard layer file found\n"); - write_text_to_log_file("Hard layer file found"); + printf("Sediment thickness file found\n"); + write_text_to_log_file("Sediment thickness file found"); int STnx, STny; double STdx, STgrdalpha; @@ -2038,9 +2063,9 @@ int main(int argc, char **argv) write_text_to_log_file("ERROR: Sediment thickness file (Hard layer file) dimension mismatch. Model will run with constant sediment thickness."); } - - - + + + } else { @@ -2051,11 +2076,10 @@ int main(int argc, char **argv) { for (int i = 0; i < nx; i++) { - stdep[i + j*nx] = 5.0f; + stdep[i + j * nx] = 5.0f; } } } - //calculate coriolis force diff --git a/XBeachGPU.h b/XBeachGPU.h index a8dbd1c..bf3bd6a 100644 --- a/XBeachGPU.h +++ b/XBeachGPU.h @@ -114,7 +114,9 @@ class XBGPUParam{ // File std::string Bathymetryfile;// bathymetry file name - std::string SedThkfile; // Structure file + std::string SedThkfile; // Structure file + std::string cfmap; // Structure file + std::string wavebndfile;// wave bnd file int wavebndtype = 2; // 1 is quasistationary wave spectrum; 2 is for infrgravity and long bound waves Xbeach type std::string slbnd; // tide/surge bnd file diff --git a/read_input.cpp b/read_input.cpp index ca913fe..5683b98 100644 --- a/read_input.cpp +++ b/read_input.cpp @@ -992,6 +992,14 @@ XBGPUParam readparamstr(std::string line, XBGPUParam param) //std::cerr << "Bathymetry file found!" << std::endl; } + parameterstr = "cfmap"; + parametervalue = findparameter(parameterstr, line); + if (!parametervalue.empty()) + { + param.cfmap = parametervalue; + //std::cerr << "Bathymetry file found!" << std::endl; + } + parameterstr = "wavebndfile"; parametervalue = findparameter(parameterstr, line); if (!parametervalue.empty())