Skip to content

Commit

Permalink
Merge pull request #25 from psakievich/multi_turb
Browse files Browse the repository at this point in the history
Fixes for the multiturbine case
  • Loading branch information
gantech authored Aug 17, 2023
2 parents 878a26e + 9a36a40 commit 984b0e8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions glue-codes/openfast-cpp/src/OpenFAST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void fast::OpenFAST::findRestartFile(int iTurbLoc) {
//Find the file and open it in read only mode
std::stringstream rstfile_ss;
rstfile_ss << "turb_" ;
rstfile_ss << std::setfill('0') << std::setw(2) << turbineMapProcToGlob[iTurbLoc];
rstfile_ss << std::setfill('0') << std::setw(2) << turbineData[iTurbLoc].TurbID;
rstfile_ss << "_rst.nc";
std::string rst_filename = rstfile_ss.str();
int ierr = nc_open(rst_filename.c_str(), NC_NOWRITE, &ncid);
Expand Down Expand Up @@ -120,7 +120,7 @@ void fast::OpenFAST::prepareRestartFile(int iTurbLoc) {
//This will destroy any existing file
std::stringstream rstfile_ss;
rstfile_ss << "turb_" ;
rstfile_ss << std::setfill('0') << std::setw(2) << turbineMapProcToGlob[iTurbLoc];
rstfile_ss << std::setfill('0') << std::setw(2) << turbineData[iTurbLoc].TurbID;
rstfile_ss << "_rst.nc";
std::string rst_filename = rstfile_ss.str();
int ierr = nc_create(rst_filename.c_str(), NC_CLOBBER, &ncid);
Expand Down Expand Up @@ -247,7 +247,7 @@ void fast::OpenFAST::findOutputFile(int iTurbLoc) {
//Find the file and open it in read only mode
std::stringstream outfile_ss;
outfile_ss << "turb_" ;
outfile_ss << std::setfill('0') << std::setw(2) << turbineMapProcToGlob[iTurbLoc];
outfile_ss << std::setfill('0') << std::setw(2) << turbineData[iTurbLoc].TurbID;
outfile_ss << "_output.nc";
std::string out_filename = outfile_ss.str();
int ierr = nc_open(out_filename.c_str(), NC_NOWRITE, &ncid);
Expand Down Expand Up @@ -283,7 +283,7 @@ void fast::OpenFAST::prepareOutputFile(int iTurbLoc) {
//Create the file - this will destory any file
std::stringstream defloads_fstream;
defloads_fstream << "turb_" ;
defloads_fstream << std::setfill('0') << std::setw(2) << turbineMapProcToGlob[iTurbLoc];
defloads_fstream << std::setfill('0') << std::setw(2) << turbineData[iTurbLoc].TurbID;
defloads_fstream << "_output.nc";
std::string defloads_filename = defloads_fstream.str();
int ierr = nc_create(defloads_filename.c_str(), NC_CLOBBER, &ncid);
Expand Down Expand Up @@ -2143,7 +2143,7 @@ int fast::OpenFAST::openVelocityDataFile(int iTurb) {
int ncid;
std::stringstream velfile_fstream;
velfile_fstream << "turb_" ;
velfile_fstream << std::setfill('0') << std::setw(2) << turbineMapProcToGlob[iTurb];
velfile_fstream << std::setfill('0') << std::setw(2) << turbineData[iTurb].TurbID;
velfile_fstream << "_veldata.nc";
std::string velfile_filename = velfile_fstream.str();
int ierr = nc_open(velfile_filename.c_str(), NC_WRITE, &ncid);
Expand All @@ -2158,7 +2158,7 @@ void fast::OpenFAST::prepareVelocityDataFile(int iTurb) {
int ncid;
std::stringstream velfile_fstream;
velfile_fstream << "turb_" ;
velfile_fstream << std::setfill('0') << std::setw(2) << turbineMapProcToGlob[iTurb];
velfile_fstream << std::setfill('0') << std::setw(2) << turbineData[iTurb].TurbID;
velfile_fstream << "_veldata.nc";
std::string velfile_filename = velfile_fstream.str();
int ierr = nc_create(velfile_filename.c_str(), NC_CLOBBER, &ncid);
Expand Down Expand Up @@ -2191,7 +2191,7 @@ void fast::OpenFAST::writeVelocityData(int iTurb, int n_t_global, int nlinIter)
//Find the file and open it in append mode
std::stringstream velfile_ss;
velfile_ss << "turb_" ;
velfile_ss << std::setfill('0') << std::setw(2) << turbineMapProcToGlob[iTurb];
velfile_ss << std::setfill('0') << std::setw(2) << turbineData[iTurb].TurbID;
velfile_ss << "_veldata.nc";
std::string vel_filename = velfile_ss.str();
int ierr = nc_open(vel_filename.c_str(), NC_WRITE, &ncid);
Expand Down Expand Up @@ -2513,7 +2513,7 @@ void fast::OpenFAST::writeOutputFile(int iTurbLoc, int n_t_global) {
//Open the file in append mode
std::stringstream outfile_ss;
outfile_ss << "turb_" ;
outfile_ss << std::setfill('0') << std::setw(2) << iTurbLoc;
outfile_ss << std::setfill('0') << std::setw(2) << turbineData[iTurbLoc].TurbID;
outfile_ss << "_output.nc";
std::string defloads_filename = outfile_ss.str();
int ierr = nc_open(defloads_filename.c_str(), NC_WRITE, &ncid);
Expand Down

0 comments on commit 984b0e8

Please sign in to comment.