diff --git a/.gitignore b/.gitignore index a6472ca28..0e6bff056 100644 --- a/.gitignore +++ b/.gitignore @@ -62,8 +62,6 @@ UserDefinedEDP SiteResponse MDOF_BuildingModel ExtractPGA -StochasticWind -StochasticGroundMotion StandardEarthquakeEDP OpenSeesInput OpenSeesPostprocessor diff --git a/conanfile.py b/conanfile.py index 8ea9a94c9..f2c6ab9e9 100644 --- a/conanfile.py +++ b/conanfile.py @@ -18,8 +18,6 @@ class simCenterBackendApps(ConanFile): # noqa: D101 } options = {'shared': [True, False]} # noqa: RUF012 default_options = { # noqa: RUF012 - 'mkl-static:threaded': False, - 'ipp-static:simcenter_backend': True, 'libcurl:with_ssl': 'openssl', } generators = 'cmake' @@ -33,6 +31,8 @@ class simCenterBackendApps(ConanFile): # noqa: D101 'jsonformoderncpp/3.7.0', 'nanoflann/1.3.2', 'nlopt/2.7.1', + 'smelt/1.2.0@simcenter/stable', + 'kissfft/131.1.0', ] # Custom attributes for Bincrafters recipe conventions diff --git a/modules/createEVENT/CMakeLists.txt b/modules/createEVENT/CMakeLists.txt index 8b37e584f..6106ae001 100644 --- a/modules/createEVENT/CMakeLists.txt +++ b/modules/createEVENT/CMakeLists.txt @@ -12,8 +12,8 @@ add_subdirectory(pointWindSpeed) add_subdirectory(LLNL_SW4) add_subdirectory(SimCenterEvent) add_subdirectory(ASCE7_WindSpeed) -#add_subdirectory(stochasticGroundMotion) -#add_subdirectory(stochasticWind) +add_subdirectory(stochasticGroundMotion) +add_subdirectory(stochasticWind) add_subdirectory(groundMotionIM) add_subdirectory(uniformPEER) add_subdirectory(experimentalWindForces) diff --git a/modules/createEVENT/stochasticGroundMotion/CMakeLists.txt b/modules/createEVENT/stochasticGroundMotion/CMakeLists.txt index d489f5b65..ecd3ae58d 100644 --- a/modules/createEVENT/stochasticGroundMotion/CMakeLists.txt +++ b/modules/createEVENT/stochasticGroundMotion/CMakeLists.txt @@ -1,4 +1,4 @@ simcenter_add_executable(NAME StochasticGM - DEPENDS CONAN_PKG::smelt CONAN_PKG::ipp-static CONAN_PKG::mkl-static) + DEPENDS CONAN_PKG::smelt CONAN_PKG::kissfft) set_property(TARGET StochasticGM PROPERTY CXX_STANDARD 17) diff --git a/modules/createEVENT/stochasticGroundMotion/main.cpp b/modules/createEVENT/stochasticGroundMotion/main.cpp index 4c064f9e1..944d3ff56 100644 --- a/modules/createEVENT/stochasticGroundMotion/main.cpp +++ b/modules/createEVENT/stochasticGroundMotion/main.cpp @@ -281,7 +281,8 @@ void throwError(std::string msg){ std::string filePathString = cwd.string(); std::size_t loc_dot = filePathString.find_last_of("."); int id = std::stoi(filePathString.substr(loc_dot+1)) ; - std::string errFile = "../workflow.err." + std::to_string(id); // e.g. workflow.err.1 + //std::string errFile = "../workflow.err." + std::to_string(id); // e.g. workflow.err.1 + std::string errFile = "./workflow.err"; // e.g. workflow.err // // Write msg to the file diff --git a/modules/createEVENT/stochasticWind/CMakeLists.txt b/modules/createEVENT/stochasticWind/CMakeLists.txt index 7e14fe704..a47587260 100644 --- a/modules/createEVENT/stochasticWind/CMakeLists.txt +++ b/modules/createEVENT/stochasticWind/CMakeLists.txt @@ -1,3 +1,4 @@ simcenter_add_executable(NAME StochasticWind - DEPENDS CONAN_PKG::smelt CONAN_PKG::ipp-static - CONAN_PKG::mkl-static common) + DEPENDS CONAN_PKG::smelt CONAN_PKG::kissfft common) + +set_property(TARGET StochasticWind PROPERTY CXX_STANDARD 17) diff --git a/modules/createEVENT/stochasticWind/main.cpp b/modules/createEVENT/stochasticWind/main.cpp index a79963815..49036c60c 100644 --- a/modules/createEVENT/stochasticWind/main.cpp +++ b/modules/createEVENT/stochasticWind/main.cpp @@ -10,6 +10,7 @@ #include "command_parser.h" #include "function_dispatcher.h" #include "wind_generator.h" +#include using json = nlohmann::json; typedef std::chrono::duration< @@ -121,24 +122,64 @@ int main(int argc, char** argv) { auto nanoseconds = std::chrono::duration_cast(duration); - auto wind_forces = - inputs.seed_provided() - ? Dispatcher, json>, std::string, - double, double, double, double, unsigned int, - double, double, int>::instance() - ->dispatch("WittigSinha1975", exposure_category, - gust_wind_speed, drag_coeff, width, height, - num_floors, total_time, force_conversion, - inputs.get_seed()) - : Dispatcher, json>, std::string, - double, double, double, double, unsigned int, - double, double, int>::instance() - ->dispatch("WittigSinha1975", exposure_category, - gust_wind_speed, drag_coeff, width, height, - num_floors, total_time, force_conversion, - nanoseconds.count()); - - auto static_forces = std::get<0>(wind_forces); + + // main seed + int seed; + if (input_data["Events"][0]["seed"].is_string()) { + // if this is "None" + seed = nanoseconds.count(); + + } else { + + int base_seed = input_data["Events"][0]["seed"].get(); + + // Get the current working directory + std::string folderName = std::filesystem::path(std::filesystem::current_path()).filename().string(); + + + // Split by '.' and get the last part (sampNum) + std::size_t pos = folderName.find_last_of('.'); + + if (pos!= std::string::npos) { + std::string samp_num_str = (pos != std::string::npos) ? folderName.substr(pos + 1) : folderName; + int samp_num = std::stoi(samp_num_str); + seed = samp_num + base_seed; + } else { + seed = base_seed; + } + + + } + + + std::cout << seed << std::endl; + auto wind_forces = Dispatcher, json>, std::string, + double, double, double, double, unsigned int, + double, double, int>::instance() + ->dispatch("WittigSinha1975", exposure_category, + gust_wind_speed, drag_coeff, width, height, + num_floors, total_time, force_conversion, + seed); + + // auto wind_forces = + // inputs.seed_provided() + // ? Dispatcher, json>, std::string, + // double, double, double, double, unsigned int, + // double, double, int>::instance() + // ->dispatch("WittigSinha1975", exposure_category, + // gust_wind_speed, drag_coeff, width, height, + // num_floors, total_time, force_conversion, + // inputs.get_seed()) + // : Dispatcher, json>, std::string, + // double, double, double, double, unsigned int, + // double, double, int>::instance() + // ->dispatch("WittigSinha1975", exposure_category, + // gust_wind_speed, drag_coeff, width, height, + // num_floors, total_time, force_conversion, + // nanoseconds.count()); + + + auto static_forces = std::get<0>(wind_forces); auto dynamic_forces = std::get<1>(wind_forces); auto pattern = json::array(); auto time_series = json::array();