From abbb24003847e75e74d1307571963e711b827946 Mon Sep 17 00:00:00 2001 From: Ganesh Vijayakumar Date: Mon, 4 Dec 2023 13:04:28 -0700 Subject: [PATCH] Changes to help compile --- glue-codes/openfast-cpp/src/OpenFAST.H | 21 +- glue-codes/openfast-cpp/src/OpenFAST.cpp | 408 ++++++------------ .../src/ExternalInflow_Registry.txt | 6 + modules/openfast-library/src/FAST_Library.f90 | 304 ++++++------- modules/openfast-library/src/FAST_Library.h | 29 +- 5 files changed, 283 insertions(+), 485 deletions(-) diff --git a/glue-codes/openfast-cpp/src/OpenFAST.H b/glue-codes/openfast-cpp/src/OpenFAST.H index ed93214575..8635f373dc 100644 --- a/glue-codes/openfast-cpp/src/OpenFAST.H +++ b/glue-codes/openfast-cpp/src/OpenFAST.H @@ -64,6 +64,8 @@ struct turbineDataType { int numForcePtsTwr; //! Total number of actuator points int numForcePts; + //! Node clustering type + int nodeClusterType; //! Inflow Type - 1 (InflowWind) or 2 (Externally specified) int inflowType; //! Drag coefficient of nacelle @@ -324,15 +326,10 @@ class OpenFAST { //! Array containing forces and deflections data for blade-resolved FSI simulations. std::vector> brFSIData; -<<<<<<< HEAD //! Data structure to get forces and deflections from ExternalInflow module in OpenFAST std::vector extinfw_i_f_FAST; // Input from OpenFAST //! Data structure to send velocity information to ExternalInflow module in OpenFAST std::vector extinfw_o_t_FAST; // Output to OpenFAST -======= - std::vector cDriver_Input_from_FAST; - std::vector cDriver_Output_to_FAST; ->>>>>>> OpenFAST/dev //! Data structure to get deflections from ExternalLoads module in OpenFAST std::vector extld_i_f_FAST; // Input from OpenFAST @@ -441,16 +438,7 @@ class OpenFAST { float & fy, float & fz); -<<<<<<< HEAD //! Allocate turbine number 'iTurbGlob' to the processor with global MPI rank 'procNo'. MUST be called from every MPI rank. -======= - hid_t openVelocityDataFile(bool createFile); - void readVelocityData(int nTimesteps); - void writeVelocityData(hid_t h5file, int iTurb, int iTimestep, ExtInfw_InputType_t iData, ExtInfw_OutputType_t oData); - herr_t closeVelocityDataFile(int nt_global, hid_t velDataFile); - void backupVelocityDataFile(int curTimeStep, hid_t & velDataFile); - ->>>>>>> OpenFAST/dev void setTurbineProcNo(int iTurbGlob, int procNo) { turbineMapGlobToProc[iTurbGlob] = procNo; } //! Allocate all turbines to processors in a round-robin fashion. MUST be called from every MPI rank. void allocateTurbinesToProcsSimple(); @@ -769,7 +757,6 @@ private: void loadSuperController(const fastInputs & fi); -<<<<<<< HEAD //! Apply the velocity data at the Aerodyn nodes in 'velData' to turbine number 'iTurb' at time step 'iPrestart' through the data structure 'cDriver_Output_to_FAST' void applyVelocityData(int iPrestart, int iTurb, ExtInfw_OutputType_t o_t_FAST, std::vector & velData) ; @@ -779,10 +766,6 @@ private: void applyWMrotation(double * wm, double * r, double *rRot, double transpose = 1.0); //! Apply a Direction Cosine Matrix rotation 'dcm' to a vector 'r' into 'rRot'. To optionally transpose the rotation, set 'tranpose=-1.0'. void applyDCMrotation(double * dcm, double * r, double *rRot, double transpose = 1.0); -======= - void setOutputsToFAST(ExtInfw_InputType_t cDriver_Input_from_FAST, ExtInfw_OutputType_t cDriver_Output_to_FAST) ; // An example to set velocities at the Aerodyn nodes - void applyVelocityData(int iPrestart, int iTurb, ExtInfw_OutputType_t cDriver_Output_to_FAST, std::vector & velData) ; ->>>>>>> OpenFAST/dev }; diff --git a/glue-codes/openfast-cpp/src/OpenFAST.cpp b/glue-codes/openfast-cpp/src/OpenFAST.cpp index 3197cc7c94..0b002df101 100644 --- a/glue-codes/openfast-cpp/src/OpenFAST.cpp +++ b/glue-codes/openfast-cpp/src/OpenFAST.cpp @@ -36,7 +36,7 @@ fast::OpenFAST::OpenFAST() sc = std::unique_ptr(new SuperController); - ncRstVarNames_ = {"time", "rst_filename", "twr_ref_pos", "bld_ref_pos", "nac_ref_pos", "hub_ref_pos", "twr_def", "twr_vel", "twr_ld", "bld_def", "bld_vel", "bld_ld", "hub_def", "hub_vel", "nac_def", "nac_vel", "bld_root_def", "bld_pitch", "x_vel", "xdot_vel", "vel_vel", "x_force", "xdot_force", "orient_force", "vel_force", "force"}; + ncRstVarNames_ = {"time", "rst_filename", "twr_ref_pos", "bld_ref_pos", "nac_ref_pos", "hub_ref_pos", "twr_def", "twr_vel", "twr_ld", "bld_def", "bld_vel", "bld_ld", "hub_def", "hub_vel", "nac_def", "nac_vel", "bld_root_def", "bld_pitch", "x_vel", "vel_vel", "x_force", "xdot_force", "orient_force", "vel_force", "force"}; ncRstDimNames_ = {"n_tsteps", "n_states", "n_twr_data", "n_bld_data", "n_pt_data", "n_bld_root_data", "n_bld_pitch_data", "n_vel_pts_data", "n_force_pts_data", "n_force_pts_orient_data"}; ncOutVarNames_ = {"time", "twr_ref_pos", "twr_ref_orient", "bld_chord", "bld_rloc", "bld_ref_pos", "bld_ref_orient", "hub_ref_pos", "hub_ref_orient", "nac_ref_pos", "nac_ref_orient", "twr_disp", "twr_orient", "twr_vel", "twr_rotvel", "twr_ld", "twr_moment", "bld_disp", "bld_orient", "bld_vel", "bld_rotvel", "bld_ld", "bld_ld_loc", "bld_moment", "hub_disp", "hub_orient", "hub_vel", "hub_rotvel", "nac_disp", "nac_orient", "nac_vel", "nac_rotvel", "bld_root_ref_pos", "bld_root_ref_orient", "bld_root_disp", "bld_root_orient"}; @@ -160,7 +160,7 @@ void fast::OpenFAST::prepareRestartFile(int iTurbLoc) { const std::vector twrDefLoadsDims{ncRstDimIDs_["n_tsteps"], ncRstDimIDs_["n_states"], ncRstDimIDs_["n_twr_data"]}; const std::vector bldDefLoadsDims{ncRstDimIDs_["n_tsteps"], ncRstDimIDs_["n_states"], ncRstDimIDs_["n_bld_data"]}; const std::vector bldRootDefsDims{ncRstDimIDs_["n_tsteps"], ncRstDimIDs_["n_states"], ncRstDimIDs_["n_bld_root_data"]}; - const std::vector bldPitchDims{ncRstDimIDs_["n_tsteps"], ncRstDimIDs_["n_states"], ncRstDimIDs_["n_bld_pitch_data"]}; + const std::vector bldPitchDims{ncRstDimIDs_["n_tsteps"], ncRstDimIDs_["n_states"], ncRstDimIDs_["n_bld_pitch_data"]}; const std::vector ptDefLoadsDims{ncRstDimIDs_["n_tsteps"], ncRstDimIDs_["n_states"], ncRstDimIDs_["n_pt_data"],}; ierr = nc_def_var(ncid, "twr_def", NC_DOUBLE, 3, twrDefLoadsDims.data(), &tmpVarID); @@ -186,7 +186,7 @@ void fast::OpenFAST::prepareRestartFile(int iTurbLoc) { ierr = nc_def_var(ncid, "bld_root_def", NC_DOUBLE, 3, bldRootDefsDims.data(), &tmpVarID); ncRstVarIDs_["bld_root_def"] = tmpVarID; ierr = nc_def_var(ncid, "bld_pitch", NC_DOUBLE, 3, bldPitchDims.data(), &tmpVarID); - ncRstVarIDs_["bld_pitch"] = tmpVarID; + ncRstVarIDs_["bld_pitch"] = tmpVarID; } else if (turbineData[iTurbLoc].sType == EXTINFLOW) { @@ -203,8 +203,6 @@ void fast::OpenFAST::prepareRestartFile(int iTurbLoc) { ierr = nc_def_var(ncid, "x_vel", NC_DOUBLE, 3, velPtsDataDims.data(), &tmpVarID); ncRstVarIDs_["x_vel"] = tmpVarID; - ierr = nc_def_var(ncid, "xdot_vel", NC_DOUBLE, 3, velPtsDataDims.data(), &tmpVarID); - ncRstVarIDs_["xdot_vel"] = tmpVarID; ierr = nc_def_var(ncid, "vel_vel", NC_DOUBLE, 3, velPtsDataDims.data(), &tmpVarID); ncRstVarIDs_["vel_vel"] = tmpVarID; ierr = nc_def_var(ncid, "xref_force", NC_DOUBLE, 1, &ncRstDimIDs_["n_force_pts_data"], &tmpVarID); @@ -425,8 +423,6 @@ void fast::OpenFAST::prepareOutputFile(int iTurbLoc) { ierr = nc_def_var(ncid, "bld_chord", NC_DOUBLE, 2, bldParamDims.data(), &tmpVarID); ncOutVarIDs_["bld_chord"] = tmpVarID; - ierr = nc_def_var(ncid, "bld_rloc", NC_DOUBLE, 2, bldParamDims.data(), &tmpVarID); - ncOutVarIDs_["bld_rloc"] = tmpVarID; ierr = nc_def_var(ncid, "twr_ref_pos", NC_DOUBLE, 2, twrRefDataDims.data(), &tmpVarID); ncOutVarIDs_["twr_ref_pos"] = tmpVarID; @@ -605,14 +601,6 @@ void fast::OpenFAST::prepareOutputFile(int iTurbLoc) { ierr = nc_put_vara_double(ncid, ncOutVarIDs_["bld_chord"], start_dim.data(), param_count_dim.data(), tmpArray.data()); } - for (size_t iBlade=0; iBlade < nBlades; iBlade++) { - int iStart = 1 + iBlade*nBldPts; - for (size_t i=0; i < nBldPts; i++) - tmpArray[i] = extinfw_i_f_FAST[iTurbLoc].forceRHloc[iStart+i]; - std::vector start_dim{iBlade,0}; - ierr = nc_put_vara_double(ncid, ncOutVarIDs_["bld_rloc"], start_dim.data(), - param_count_dim.data(), tmpArray.data()); - } } } @@ -623,8 +611,6 @@ void fast::OpenFAST::prepareOutputFile(int iTurbLoc) { void fast::OpenFAST::init() { - // Temporary buffer to pass filenames to OpenFAST fortran subroutines - char currentFileName[INTERFACE_STRING_LENGTH]; allocateMemory_preInit(); @@ -634,7 +620,6 @@ void fast::OpenFAST::init() { case fast::trueRestart: for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { -<<<<<<< HEAD findRestartFile(iTurb); findOutputFile(iTurb); @@ -643,38 +628,40 @@ void fast::OpenFAST::init() { tmpRstFileRoot[turbineData[iTurb].FASTRestartFileName.size()] = '\0'; if (turbineData[iTurb].sType == EXTINFLOW) { /* note that this will set nt_global inside the FAST library */ - FAST_AL_CFD_Restart(&iTurb, tmpRstFileRoot, &AbortErrLev, &turbineData[iTurb].dt, &turbineData[iTurb].inflowType, &turbineData[iTurb].numBlades, &turbineData[iTurb].numVelPtsBlade, &turbineData[iTurb].numVelPtsTwr, &ntStart, &extinfw_i_f_FAST[iTurb], &extinfw_o_t_FAST[iTurb], &sc->ip_from_FAST[iTurb], &sc->op_to_FAST[iTurb], &ErrStat, ErrMsg); + FAST_ExtInfw_Restart( + &iTurb, + tmpRstFileRoot, + &AbortErrLev, + &turbineData[iTurb].dt, + &turbineData[iTurb].inflowType, + &turbineData[iTurb].numBlades, + &turbineData[iTurb].numVelPtsBlade, + &turbineData[iTurb].numVelPtsTwr, + &ntStart, + &extinfw_i_f_FAST[iTurb], + &extinfw_o_t_FAST[iTurb], + &sc->ip_from_FAST[iTurb], + &sc->op_to_FAST[iTurb], + &ErrStat, + ErrMsg); checkError(ErrStat, ErrMsg); - } else if(turbineData[iTurb].sType == EXTLOADS) { - FAST_BR_CFD_Restart(&iTurb, tmpRstFileRoot, &AbortErrLev, &turbineData[iTurb].dt, &turbineData[iTurb].numBlades, &ntStart, &extld_i_f_FAST[iTurb], &extld_o_t_FAST[iTurb], &sc->ip_from_FAST[iTurb], &sc->op_to_FAST[iTurb], &ErrStat, ErrMsg); + FAST_ExtLoads_Restart( + &iTurb, + tmpRstFileRoot, + &AbortErrLev, + &turbineData[iTurb].dt, + &turbineData[iTurb].numBlades, + &ntStart, + &extld_i_f_FAST[iTurb], + &extld_o_t_FAST[iTurb], + &sc->ip_from_FAST[iTurb], + &sc->op_to_FAST[iTurb], + &ErrStat, + ErrMsg); turbineData[iTurb].inflowType = 0; } -======= - /* note that this will set nt_global inside the FAST library */ - std::copy( - CheckpointFileRoot[iTurb].data(), - CheckpointFileRoot[iTurb].data() + (CheckpointFileRoot[iTurb].size() + 1), - currentFileName - ); - FAST_ExtInfw_Restart( - &iTurb, - currentFileName, - &AbortErrLev, - &dtFAST, - &numBlades[iTurb], - &numVelPtsBlade[iTurb], - &ntStart, - &cDriver_Input_from_FAST[iTurb], - &cDriver_Output_to_FAST[iTurb], - &sc.ip_from_FAST[iTurb], - &sc.op_to_FAST[iTurb], - &ErrStat, - ErrMsg - ); - checkError(ErrStat, ErrMsg); ->>>>>>> OpenFAST/dev nt_global = ntStart; allocateMemory_postInit(iTurb); @@ -702,55 +689,44 @@ void fast::OpenFAST::init() { } // this calls the Init() routines of each module for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { -<<<<<<< HEAD -======= - int nodeClusterType = 0; - if (forcePtsBladeDistributionType[iTurb] == "chordClustered") - { - nodeClusterType = 1; - } - std::copy( - FASTInputFileName[iTurb].data(), - FASTInputFileName[iTurb].data() + (FASTInputFileName[iTurb].size() + 1), - currentFileName - ); - FAST_ExtInfw_Init( - &iTurb, - &tMax, - currentFileName, - &TurbID[iTurb], - &scio.nSC2CtrlGlob, - &scio.nSC2Ctrl, - &scio.nCtrl2SC, - scio.from_SCglob.data(), - scio.from_SC[iTurb].data(), - &numForcePtsBlade[iTurb], - &numForcePtsTwr[iTurb], - TurbineBasePos[iTurb].data(), - &AbortErrLev, - &dtFAST, - &numBlades[iTurb], - &numVelPtsBlade[iTurb], - &nodeClusterType, - &cDriver_Input_from_FAST[iTurb], - &cDriver_Output_to_FAST[iTurb], - &sc.ip_from_FAST[iTurb], - &sc.op_to_FAST[iTurb], - &ErrStat, - ErrMsg - ); - checkError(ErrStat, ErrMsg); ->>>>>>> OpenFAST/dev char tmpOutFileRoot[INTERFACE_STRING_LENGTH]; + char inputFileName[INTERFACE_STRING_LENGTH]; if (turbineData[iTurb].sType == EXTINFLOW) { std::copy( turbineData[iTurb].FASTInputFileName.data(), turbineData[iTurb].FASTInputFileName.data() + (turbineData[iTurb].FASTInputFileName.size() + 1), - currentFileName + inputFileName ); - FAST_AL_CFD_Init( &iTurb, &tMax, turbineData[iTurb].FASTInputFileName.data(), &turbineData[iTurb].TurbID, tmpOutFileRoot, &scio.nSC2CtrlGlob, &scio.nSC2Ctrl, &scio.nCtrl2SC, scio.from_SCglob.data(), scio.from_SC[iTurb].data(), &turbineData[iTurb].numForcePtsBlade, &turbineData[iTurb].numForcePtsTwr, turbineData[iTurb].TurbineBasePos.data(), &AbortErrLev, &dtDriver, &turbineData[iTurb].dt, &turbineData[iTurb].inflowType, &turbineData[iTurb].numBlades, &turbineData[iTurb].numVelPtsBlade, &turbineData[iTurb].numVelPtsTwr, &extinfw_i_f_FAST[iTurb], &extinfw_o_t_FAST[iTurb], &sc->ip_from_FAST[iTurb], &sc->op_to_FAST[iTurb], &ErrStat, ErrMsg); + FAST_ExtInfw_Init( + &iTurb, + &tMax, + inputFileName, + &turbineData[iTurb].TurbID, + tmpOutFileRoot, + &scio.nSC2CtrlGlob, + &scio.nSC2Ctrl, + &scio.nCtrl2SC, + scio.from_SCglob.data(), + scio.from_SC[iTurb].data(), + &turbineData[iTurb].numForcePtsBlade, + &turbineData[iTurb].numForcePtsTwr, + turbineData[iTurb].TurbineBasePos.data(), + &AbortErrLev, + &dtDriver, + &turbineData[iTurb].dt, + &turbineData[iTurb].inflowType, + &turbineData[iTurb].numBlades, + &turbineData[iTurb].numVelPtsBlade, + &turbineData[iTurb].numVelPtsTwr, + &turbineData[iTurb].nodeClusterType, + &extinfw_i_f_FAST[iTurb], + &extinfw_o_t_FAST[iTurb], + &sc->ip_from_FAST[iTurb], + &sc->op_to_FAST[iTurb], + &ErrStat, + ErrMsg); checkError(ErrStat, ErrMsg); turbineData[iTurb].numVelPtsTwr = extinfw_o_t_FAST[iTurb].u_Len - turbineData[iTurb].numBlades*turbineData[iTurb].numVelPtsBlade - 1; @@ -761,7 +737,30 @@ void fast::OpenFAST::init() { } else if(turbineData[iTurb].sType == EXTLOADS) { - FAST_BR_CFD_Init(&iTurb, &tMax, turbineData[iTurb].FASTInputFileName.data(), &turbineData[iTurb].TurbID, tmpOutFileRoot, turbineData[iTurb].TurbineBasePos.data(), &AbortErrLev, &dtDriver, &turbineData[iTurb].dt, &turbineData[iTurb].numBlades, &turbineData[iTurb].azBlendMean, &turbineData[iTurb].azBlendDelta, &turbineData[iTurb].velMean, &turbineData[iTurb].windDir, &turbineData[iTurb].zRef, &turbineData[iTurb].shearExp, &extld_i_f_FAST[iTurb], &extld_o_t_FAST[iTurb], &sc->ip_from_FAST[iTurb], &sc->op_to_FAST[iTurb], &ErrStat, ErrMsg); + char inputFileName[INTERFACE_STRING_LENGTH]; + FAST_ExtLoads_Init( + &iTurb, + &tMax, + turbineData[iTurb].FASTInputFileName.data(), + &turbineData[iTurb].TurbID, + tmpOutFileRoot, + turbineData[iTurb].TurbineBasePos.data(), + &AbortErrLev, + &dtDriver, + &turbineData[iTurb].dt, + &turbineData[iTurb].numBlades, + &turbineData[iTurb].azBlendMean, + &turbineData[iTurb].azBlendDelta, + &turbineData[iTurb].velMean, + &turbineData[iTurb].windDir, + &turbineData[iTurb].zRef, + &turbineData[iTurb].shearExp, + &extld_i_f_FAST[iTurb], + &extld_o_t_FAST[iTurb], + &sc->ip_from_FAST[iTurb], + &sc->op_to_FAST[iTurb], + &ErrStat, + ErrMsg); checkError(ErrStat, ErrMsg); turbineData[iTurb].inflowType = 0; @@ -796,58 +795,47 @@ void fast::OpenFAST::init() { } for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { -<<<<<<< HEAD -======= - int nodeClusterType = 0; - if (forcePtsBladeDistributionType[iTurb] == "chordClustered") - { - nodeClusterType = 1; - } - std::copy( - FASTInputFileName[iTurb].data(), - FASTInputFileName[iTurb].data() + (FASTInputFileName[iTurb].size() + 1), - currentFileName - ); - FAST_ExtInfw_Init( - &iTurb, - &tMax, - currentFileName, - &TurbID[iTurb], - &scio.nSC2CtrlGlob, - &scio.nSC2Ctrl, - &scio.nCtrl2SC, - scio.from_SCglob.data(), - scio.from_SC[iTurb].data(), - &numForcePtsBlade[iTurb], - &numForcePtsTwr[iTurb], - TurbineBasePos[iTurb].data(), - &AbortErrLev, - &dtFAST, - &numBlades[iTurb], - &numVelPtsBlade[iTurb], - &nodeClusterType, - &cDriver_Input_from_FAST[iTurb], - &cDriver_Output_to_FAST[iTurb], - &sc.ip_from_FAST[iTurb], - &sc.op_to_FAST[iTurb], - &ErrStat, - ErrMsg - ); - checkError(ErrStat, ErrMsg); ->>>>>>> OpenFAST/dev findOutputFile(iTurb); findRestartFile(iTurb); char tmpOutFileRoot[INTERFACE_STRING_LENGTH]; + char inputFileName[INTERFACE_STRING_LENGTH]; if (turbineData[iTurb].sType == EXTINFLOW) { std::copy( turbineData[iTurb].FASTInputFileName.data(), turbineData[iTurb].FASTInputFileName.data() + (turbineData[iTurb].FASTInputFileName.size() + 1), - currentFileName + inputFileName ); - FAST_AL_CFD_Init( &iTurb, &tMax, turbineData[iTurb].FASTInputFileName.data(), &turbineData[iTurb].TurbID, tmpOutFileRoot, &scio.nSC2CtrlGlob, &scio.nSC2Ctrl, &scio.nCtrl2SC, scio.from_SCglob.data(), scio.from_SC[iTurb].data(), &turbineData[iTurb].numForcePtsBlade, &turbineData[iTurb].numForcePtsTwr, turbineData[iTurb].TurbineBasePos.data(), &AbortErrLev, &dtDriver, &turbineData[iTurb].dt, &turbineData[iTurb].inflowType, &turbineData[iTurb].numBlades, &turbineData[iTurb].numVelPtsBlade, &turbineData[iTurb].numVelPtsTwr, &extinfw_i_f_FAST[iTurb], &extinfw_o_t_FAST[iTurb], &sc->ip_from_FAST[iTurb], &sc->op_to_FAST[iTurb], &ErrStat, ErrMsg); + FAST_ExtInfw_Init( + &iTurb, + &tMax, + inputFileName, + &turbineData[iTurb].TurbID, + tmpOutFileRoot, + &scio.nSC2CtrlGlob, + &scio.nSC2Ctrl, + &scio.nCtrl2SC, + scio.from_SCglob.data(), + scio.from_SC[iTurb].data(), + &turbineData[iTurb].numForcePtsBlade, + &turbineData[iTurb].numForcePtsTwr, + turbineData[iTurb].TurbineBasePos.data(), + &AbortErrLev, + &dtDriver, + &turbineData[iTurb].dt, + &turbineData[iTurb].inflowType, + &turbineData[iTurb].numBlades, + &turbineData[iTurb].numVelPtsBlade, + &turbineData[iTurb].numVelPtsTwr, + &turbineData[iTurb].nodeClusterType, + &extinfw_i_f_FAST[iTurb], + &extinfw_o_t_FAST[iTurb], + &sc->ip_from_FAST[iTurb], + &sc->op_to_FAST[iTurb], + &ErrStat, + ErrMsg); checkError(ErrStat, ErrMsg); timeZero = true; @@ -949,12 +937,8 @@ void fast::OpenFAST::solution0(bool writeFiles) { send_data_to_openfast(fast::STATE_NP1); for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { -<<<<<<< HEAD FAST_CFD_Solution0(&iTurb, &ErrStat, ErrMsg); -======= - FAST_ExtInfw_Solution0(&iTurb, &ErrStat, ErrMsg); ->>>>>>> OpenFAST/dev checkError(ErrStat, ErrMsg); FAST_CFD_InitIOarrays_SS(&iTurb, &ErrStat, ErrMsg); @@ -987,14 +971,12 @@ void fast::OpenFAST::set_state_from_state(fast::timeStep fromState, fast::timeSt for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) { -<<<<<<< HEAD if (turbineData[iTurb].sType == EXTINFLOW) { int nvelpts = get_numVelPtsLoc(iTurb); int nfpts = get_numForcePtsLoc(iTurb); for (int i=0; i0.) { - calc_nacelle_force ( - cDriver_Output_to_FAST[iTurb].u[0], - cDriver_Output_to_FAST[iTurb].v[0], - cDriver_Output_to_FAST[iTurb].w[0], - nacelle_cd[iTurb], - nacelle_area[iTurb], - air_density[iTurb], - cDriver_Input_from_FAST[iTurb].fx[0], - cDriver_Input_from_FAST[iTurb].fy[0], - cDriver_Input_from_FAST[iTurb].fz[0] - ); - } - - if ( isDebug() ) { - std::ofstream actuatorForcesFile; - actuatorForcesFile.open("actuator_forces.csv") ; - actuatorForcesFile << "# x, y, z, fx, fy, fz" << std::endl ; - for (int iNode=0; iNode < get_numForcePtsLoc(iTurb); iNode++) { - actuatorForcesFile << cDriver_Input_from_FAST[iTurb].pxForce[iNode] << ", " << cDriver_Input_from_FAST[iTurb].pyForce[iNode] << ", " << cDriver_Input_from_FAST[iTurb].pzForce[iNode] << ", " << cDriver_Input_from_FAST[iTurb].fx[iNode] << ", " << cDriver_Input_from_FAST[iTurb].fy[iNode] << ", " << cDriver_Input_from_FAST[iTurb].fz[iNode] << " " << std::endl ; ->>>>>>> OpenFAST/dev } } } @@ -1166,12 +1102,10 @@ void fast::OpenFAST::predict_states() { for (int i=0; i>>>>>> OpenFAST/dev checkError(ErrStat, ErrMsg); } @@ -1680,11 +1602,7 @@ void fast::OpenFAST::setDriverCheckpoint(int nt_checkpoint_driver) { } } -<<<<<<< HEAD void fast::OpenFAST::get_turbineParams(int iTurbGlob, turbineDataType & turbData) { -======= -void fast::OpenFAST::setOutputsToFAST(ExtInfw_InputType_t cDriver_Input_from_FAST, ExtInfw_OutputType_t cDriver_Output_to_FAST){ ->>>>>>> OpenFAST/dev //TODO: Figure out a better copy operator for the turbineDataType struct int iTurbLoc = get_localTurbNo(iTurbGlob); @@ -1729,6 +1647,7 @@ void fast::OpenFAST::setOutputsToFAST(ExtInfw_InputType_t cDriver_Input_from_FAS } + void fast::OpenFAST::checkError(const int ErrStat, const char * ErrMsg) { if (ErrStat != ErrID_None){ @@ -1835,13 +1754,8 @@ void fast::OpenFAST::getForce(double* currentForce, int iNode, int iTurbGlob, fa double fast::OpenFAST::getRHloc(int iNode, int iTurbGlob) { // Return radial location/height along blade/tower at current node of current turbine - int iTurbLoc = get_localTurbNo(iTurbGlob); - if (turbineData[iTurbLoc].sType == EXTINFLOW) { - for(int j=0; j < iTurbLoc; j++) iNode = iNode - get_numForcePtsLoc(iTurbLoc); - return extinfw_i_f_FAST[iTurbLoc].forceRHloc[iNode] ; - } else { - return -1.0; - } + // Inactive for now + return -1.0; } @@ -1995,7 +1909,7 @@ void fast::OpenFAST::computeTorqueThrust(int iTurbGlob, double* torque, double* std::vector hubShftVec(3); getHubShftDir(hubShftVec, iTurbGlob, fast::STATE_NP1); - + int nfpts = get_numForcePtsBlade(iTurbLoc); for (int k=0; k < get_numBladesLoc(iTurbLoc); k++) { for (int j=0; j < nfpts; j++) { @@ -2151,17 +2065,12 @@ void fast::OpenFAST::allocateMemory_preInit() { FAST_AllocateTurbines(&nTurbinesProc, &ErrStat, ErrMsg); // Allocate memory for ExtInfw Input types in FAST -<<<<<<< HEAD extinfw_i_f_FAST.resize(nTurbinesProc) ; extinfw_o_t_FAST.resize(nTurbinesProc) ; // Allocate memory for ExtLd Input types in FAST extld_i_f_FAST.resize(nTurbinesProc) ; extld_o_t_FAST.resize(nTurbinesProc) ; -======= - cDriver_Input_from_FAST.resize(nTurbinesProc) ; - cDriver_Output_to_FAST.resize(nTurbinesProc) ; ->>>>>>> OpenFAST/dev if(scStatus) { std::cout << "Use of Supercontroller is not supported through the C++ API right now" << std::endl; @@ -2195,7 +2104,6 @@ void fast::OpenFAST::allocateMemory_postInit(int iTurbLoc) { velForceNodeData[iTurbLoc][3].xref_force.resize(3*nfpts); for(int k=0; k<4; k++) { velForceNodeData[iTurbLoc][k].x_vel.resize(3*nvelpts) ; - velForceNodeData[iTurbLoc][k].xdot_vel.resize(3*nvelpts) ; velForceNodeData[iTurbLoc][k].vel_vel.resize(3*nvelpts) ; velForceNodeData[iTurbLoc][k].x_force.resize(3*nfpts) ; velForceNodeData[iTurbLoc][k].xdot_force.resize(3*nfpts) ; @@ -2459,12 +2367,6 @@ void fast::OpenFAST::get_data_from_openfast(timeStep t) { velForceNodeData[iTurb][t].x_vel[i*3+1] = extinfw_i_f_FAST[iTurb].pyVel[i]; velForceNodeData[iTurb][t].x_vel_resid += (velForceNodeData[iTurb][t].x_vel[i*3+2] - extinfw_i_f_FAST[iTurb].pzVel[i])*(velForceNodeData[iTurb][t].x_vel[i*3+2] - extinfw_i_f_FAST[iTurb].pzVel[i]); velForceNodeData[iTurb][t].x_vel[i*3+2] = extinfw_i_f_FAST[iTurb].pzVel[i]; - velForceNodeData[iTurb][t].xdot_vel_resid += (velForceNodeData[iTurb][t].xdot_vel[i*3+0] - extinfw_i_f_FAST[iTurb].pxdotVel[i])*(velForceNodeData[iTurb][t].xdot_vel[i*3+0] - extinfw_i_f_FAST[iTurb].pxdotVel[i]); - velForceNodeData[iTurb][t].xdot_vel[i*3+0] = extinfw_i_f_FAST[iTurb].pxdotVel[i]; - velForceNodeData[iTurb][t].xdot_vel_resid += (velForceNodeData[iTurb][t].xdot_vel[i*3+1] - extinfw_i_f_FAST[iTurb].pydotVel[i])*(velForceNodeData[iTurb][t].xdot_vel[i*3+1] - extinfw_i_f_FAST[iTurb].pydotVel[i]); - velForceNodeData[iTurb][t].xdot_vel[i*3+1] = extinfw_i_f_FAST[iTurb].pydotVel[i]; - velForceNodeData[iTurb][t].xdot_vel_resid += (velForceNodeData[iTurb][t].xdot_vel[i*3+2] - extinfw_i_f_FAST[iTurb].pzdotVel[i])*(velForceNodeData[iTurb][t].xdot_vel[i*3+2] - extinfw_i_f_FAST[iTurb].pzdotVel[i]); - velForceNodeData[iTurb][t].xdot_vel[i*3+2] = extinfw_i_f_FAST[iTurb].pzdotVel[i]; } for (int i=0; i start_dim{n_tsteps,j,0}; ierr = nc_get_vara_double(ncid, ncRstVarIDs_["x_vel"], start_dim.data(), velPtsDataDims.data(), velForceNodeData[iTurbLoc][j].x_vel.data()); - ierr = nc_get_vara_double(ncid, ncRstVarIDs_["xdot_vel"], start_dim.data(), velPtsDataDims.data(), velForceNodeData[iTurbLoc][j].xdot_vel.data()); ierr = nc_get_vara_double(ncid, ncRstVarIDs_["vel_vel"], start_dim.data(), velPtsDataDims.data(), velForceNodeData[iTurbLoc][j].vel_vel.data()); ierr = nc_get_vara_double(ncid, ncRstVarIDs_["x_force"], start_dim.data(), forcePtsDataDims.data(), velForceNodeData[iTurbLoc][j].x_force.data()); ierr = nc_get_vara_double(ncid, ncRstVarIDs_["xdot_force"], start_dim.data(), forcePtsDataDims.data(), velForceNodeData[iTurbLoc][j].xdot_force.data()); @@ -2591,7 +2492,7 @@ void fast::OpenFAST::readRestartFile(int iTurbLoc, int n_t_global) { const std::vector twrDataDims{1, 1, static_cast(6*nBRfsiPtsTwr)}; const std::vector bldDataDims{1, 1, static_cast(6*nTotBRfsiPtsBlade)}; const std::vector bldRootDataDims{1, 1, static_cast(6*nBlades)}; - const std::vector bldPitchDataDims{1, 1, static_cast(nBlades)}; + const std::vector bldPitchDataDims{1, 1, static_cast(nBlades)}; const std::vector ptDataDims{1, 1, 6}; for (size_t j=0; j < 4; j++) { // Loop over states - NM2, STATE_NM1, N, NP1 @@ -2617,7 +2518,7 @@ void fast::OpenFAST::readRestartFile(int iTurbLoc, int n_t_global) { } - + } @@ -2996,7 +2897,6 @@ void fast::OpenFAST::writeRestartFile(int iTurbLoc, int n_t_global) { const std::vector start_dim{n_tsteps,j,0}; ierr = nc_put_vara_double(ncid, ncRstVarIDs_["x_vel"], start_dim.data(), velPtsDataDims.data(), velForceNodeData[iTurbLoc][j].x_vel.data()); - ierr = nc_put_vara_double(ncid, ncRstVarIDs_["xdot_vel"], start_dim.data(), velPtsDataDims.data(), velForceNodeData[iTurbLoc][j].xdot_vel.data()); ierr = nc_put_vara_double(ncid, ncRstVarIDs_["vel_vel"], start_dim.data(), velPtsDataDims.data(), velForceNodeData[iTurbLoc][j].vel_vel.data()); ierr = nc_put_vara_double(ncid, ncRstVarIDs_["x_force"], start_dim.data(), forcePtsDataDims.data(), velForceNodeData[iTurbLoc][j].x_force.data()); ierr = nc_put_vara_double(ncid, ncRstVarIDs_["xdot_force"], start_dim.data(), forcePtsDataDims.data(), velForceNodeData[iTurbLoc][j].xdot_force.data()); @@ -3013,7 +2913,7 @@ void fast::OpenFAST::writeRestartFile(int iTurbLoc, int n_t_global) { const std::vector twrDataDims{1, 1, static_cast(6*nPtsTwr)}; const std::vector bldDataDims{1, 1, static_cast(6*nTotBldPts)}; const std::vector bldRootDataDims{1, 1, static_cast(6*nBlades)}; - const std::vector bldPitchDataDims{1, 1, static_cast(nBlades)}; + const std::vector bldPitchDataDims{1, 1, static_cast(nBlades)}; const std::vector ptDataDims{1, 1, 6}; for (size_t j=0; j < 4; j++) { // Loop over states - STATE_NM2, STATE_NM1, STATE_N, STATE_NP1 @@ -3183,7 +3083,7 @@ void fast::OpenFAST::getBladeDisplacements(double* bldDefl, double* bldVel, int << brFSIData[iTurbLoc][t].bld_vel[iRunTot*6+3] << "," << brFSIData[iTurbLoc][t].bld_vel[iRunTot*6+4] << "," << brFSIData[iTurbLoc][t].bld_vel[iRunTot*6+5] << std::endl; - + for (int k=0; k < nSize; k++) { bldDefl[iRunTot*6+k] = brFSIData[iTurbLoc][t].bld_def[iRunTot*6+k]; bldVel[iRunTot*6+k] = brFSIData[iTurbLoc][t].bld_vel[iRunTot*6+k]; @@ -3228,7 +3128,6 @@ void fast::OpenFAST::getTowerRefPositions(double* twrRefPos, int iTurbGlob, int void fast::OpenFAST::getTowerDisplacements(double* twrDefl, double* twrVel, int iTurbGlob, fast::timeStep t, int nSize) { -<<<<<<< HEAD int iTurbLoc = get_localTurbNo(iTurbGlob); int nPtsTwr = turbineData[iTurbLoc].nBRfsiPtsTwr; for (int i=0; i < nPtsTwr; i++) { @@ -3236,38 +3135,6 @@ void fast::OpenFAST::getTowerDisplacements(double* twrDefl, double* twrVel, int twrDefl[i*6+j] = brFSIData[iTurbLoc][t].twr_def[i*6+j]; twrVel[i*6+j] = brFSIData[iTurbLoc][t].twr_vel[i*6+j]; } -======= -void fast::OpenFAST::backupVelocityDataFile(int curTimeStep, hid_t & velDataFile) { - - closeVelocityDataFile(curTimeStep, velDataFile); - - std::ifstream source("velDatafile." + std::to_string(worldMPIRank) + ".h5", std::ios::binary); - std::ofstream dest("velDatafile." + std::to_string(worldMPIRank) + ".h5." + std::to_string(curTimeStep) + ".bak", std::ios::binary); - - dest << source.rdbuf(); - source.close(); - dest.close(); - - velDataFile = openVelocityDataFile(false); -} - -void fast::OpenFAST::writeVelocityData(hid_t h5File, int iTurb, int iTimestep, ExtInfw_InputType_t iData, ExtInfw_OutputType_t oData) { - - hsize_t start[3]; start[0] = iTimestep; start[1] = 0; start[2] = 0; - int nVelPts = get_numVelPtsLoc(iTurb) ; - hsize_t count[3]; count[0] = 1; count[1] = nVelPts; count[2] = 6; - - std::vector tmpVelData; - tmpVelData.resize(nVelPts * 6); - - for (int iNode=0 ; iNode < nVelPts; iNode++) { - tmpVelData[iNode*6 + 0] = iData.pxVel[iNode]; - tmpVelData[iNode*6 + 1] = iData.pyVel[iNode]; - tmpVelData[iNode*6 + 2] = iData.pzVel[iNode]; - tmpVelData[iNode*6 + 3] = oData.u[iNode]; - tmpVelData[iNode*6 + 4] = oData.v[iNode]; - tmpVelData[iNode*6 + 5] = oData.w[iNode]; ->>>>>>> OpenFAST/dev } } @@ -3280,7 +3147,6 @@ void fast::OpenFAST::getHubRefPosition(double* hubRefPos, int iTurbGlob, int nSi } -<<<<<<< HEAD void fast::OpenFAST::getHubDisplacement(double* hubDefl, double* hubVel, int iTurbGlob, fast::timeStep t, int nSize) { int iTurbLoc = get_localTurbNo(iTurbGlob); @@ -3361,7 +3227,7 @@ void fast::OpenFAST::setUniformXBladeForces(double loadX) { int nBldPts = turbineData[iTurb].nBRfsiPtsBlade[iBlade]; dr[iNode] = 0.5*(brFSIData[iTurb][3].bld_rloc[iNode+1] - brFSIData[iTurb][3].bld_rloc[iNode]); iNode++; - + for(int i=1; i < nBldPts-1; i++) { dr[iNode] = 0.5*(brFSIData[iTurb][3].bld_rloc[iNode+1] - brFSIData[iTurb][3].bld_rloc[iNode-1]); iNode++; @@ -3375,14 +3241,6 @@ void fast::OpenFAST::setUniformXBladeForces(double loadX) { setBladeForces(fsiForceBlade, iTurbGlob, fast::STATE_NP1); -======= -void fast::OpenFAST::applyVelocityData(int iPrestart, int iTurb, ExtInfw_OutputType_t cDriver_Output_to_FAST, std::vector & velData) { - int nVelPts = get_numVelPtsLoc(iTurb); - for (int j = 0; j < nVelPts; j++){ - cDriver_Output_to_FAST.u[j] = velData[(iPrestart*nVelPts+j)*6 + 3]; - cDriver_Output_to_FAST.v[j] = velData[(iPrestart*nVelPts+j)*6 + 4]; - cDriver_Output_to_FAST.w[j] = velData[(iPrestart*nVelPts+j)*6 + 5]; ->>>>>>> OpenFAST/dev } } diff --git a/modules/externalinflow/src/ExternalInflow_Registry.txt b/modules/externalinflow/src/ExternalInflow_Registry.txt index e066d5c414..e5659ed467 100644 --- a/modules/externalinflow/src/ExternalInflow_Registry.txt +++ b/modules/externalinflow/src/ExternalInflow_Registry.txt @@ -54,9 +54,15 @@ typedef ExternalInflow/ExtInfw ParameterType IntKi NodeClusterType - typedef ^ InputType ReKi pxVel {:} - - "x position of velocity interface (Aerodyn) nodes" "m" typedef ^ InputType ReKi pyVel {:} - - "y position of velocity interface (Aerodyn) nodes" "m" typedef ^ InputType ReKi pzVel {:} - - "z position of velocity interface (Aerodyn) nodes" "m" +typedef ^ InputType ReKi pxdotVel {:} - - "x of velocity interface (Aerodyn) nodes" "m" +typedef ^ InputType ReKi pydotVel {:} - - "y position of velocity interface (Aerodyn) nodes" "m" +typedef ^ InputType ReKi pzdotVel {:} - - "z position of velocity interface (Aerodyn) nodes" "m" typedef ^ InputType ReKi pxForce {:} - - "x position of actuator force nodes" "m" typedef ^ InputType ReKi pyForce {:} - - "y position of actuator force nodes" "m" typedef ^ InputType ReKi pzForce {:} - - "z position of actuator force nodes" "m" +typedef ^ InputType ReKi pxdotForce {:} - - "x velocity of actuator force nodes" "m/s" +typedef ^ InputType ReKi pydotForce {:} - - "y velocity of actuator force nodes" "m/s" +typedef ^ InputType ReKi pzdotForce {:} - - "z velocity of actuator force nodes" "m/s" typedef ^ InputType ReKi xdotForce {:} - - "x velocity of actuator force nodes" "m/s" typedef ^ InputType ReKi ydotForce {:} - - "y velocity of actuator force nodes" "m/s" typedef ^ InputType ReKi zdotForce {:} - - "z velocity of actuator force nodes" "m/s" diff --git a/modules/openfast-library/src/FAST_Library.f90 b/modules/openfast-library/src/FAST_Library.f90 index 38b93fa258..247137d84d 100644 --- a/modules/openfast-library/src/FAST_Library.f90 +++ b/modules/openfast-library/src/FAST_Library.f90 @@ -508,14 +508,14 @@ subroutine FAST_Restart(iTurb, CheckpointRootName_c, AbortErrLev_c, NumOuts_c, d end subroutine FAST_Restart !================================================================================================================================== -subroutine FAST_BR_CFD_Init(iTurb, TMax, InputFileName_c, TurbID, OutFileRoot_c, TurbPosn, AbortErrLev_c, dtDriver_c, dt_c, NumBl_c, & +subroutine FAST_ExtLoads_Init(iTurb, TMax, InputFileName_c, TurbID, OutFileRoot_c, TurbPosn, AbortErrLev_c, dtDriver_c, dt_c, NumBl_c, & az_blend_mean_c, az_blend_delta_c, vel_mean_c, wind_dir_c, z_ref_c, shear_exp_c, & - ExtLd_Input_from_FAST, ExtLd_Output_to_FAST, SC_DX_Input_from_FAST, SC_DX_Output_to_FAST, ErrStat_c, ErrMsg_c) BIND (C, NAME='FAST_BR_CFD_Init') -!DEC$ ATTRIBUTES DLLEXPORT::FAST_BR_CFD_Init + ExtLd_Input_from_FAST, ExtLd_Output_to_FAST, SC_DX_Input_from_FAST, SC_DX_Output_to_FAST, ErrStat_c, ErrMsg_c) BIND (C, NAME='FAST_ExtLoads_Init') +!DEC$ ATTRIBUTES DLLEXPORT::FAST_ExtLoads_Init IMPLICIT NONE #ifndef IMPLICIT_DLLEXPORT -!DEC$ ATTRIBUTES DLLEXPORT :: FAST_BR_CFD_Init -!GCC$ ATTRIBUTES DLLEXPORT :: FAST_BR_CFD_Init +!DEC$ ATTRIBUTES DLLEXPORT :: FAST_ExtLoads_Init +!GCC$ ATTRIBUTES DLLEXPORT :: FAST_ExtLoads_Init #endif INTEGER(C_INT), INTENT(IN ) :: iTurb ! Turbine number REAL(C_DOUBLE), INTENT(IN ) :: TMax @@ -546,7 +546,7 @@ subroutine FAST_BR_CFD_Init(iTurb, TMax, InputFileName_c, TurbID, OutFileRoot_c, TYPE(FAST_ExternInitType) :: ExternInitData INTEGER(IntKi) :: CompLoadsType - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_BR_CFD_Init' + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_ExtLoads_Init' ! transfer the character array from C to a Fortran string: InputFileName = TRANSFER( InputFileName_c, InputFileName ) @@ -604,72 +604,68 @@ subroutine FAST_BR_CFD_Init(iTurb, TMax, InputFileName_c, TurbID, OutFileRoot_c, ErrStat_c = ErrStat ErrMsg_c = TRANSFER( trim(ErrMsg)//C_NULL_CHAR, ErrMsg_c ) -end subroutine FAST_BR_CFD_Init - +end subroutine FAST_ExtLoads_Init !================================================================================================================================== -subroutine FAST_AL_CFD_Init(iTurb, TMax, InputFileName_c, TurbID, OutFileRoot_c, NumSC2CtrlGlob, NumSC2Ctrl, NumCtrl2SC, InitSCOutputsGlob, InitSCOutputsTurbine, & - NumActForcePtsBlade, NumActForcePtsTower, TurbPosn, AbortErrLev_c, dtDriver_c, dt_c, InflowType, NumBl_c, NumBlElem_c, NumTwrElem_c, & - ExtInfw_Input_from_FAST, ExtInfw_Output_to_FAST, SC_DX_Input_from_FAST, SC_DX_Output_to_FAST, ErrStat_c, ErrMsg_c) BIND (C, NAME='FAST_AL_CFD_Init') -!DEC$ ATTRIBUTES DLLEXPORT::FAST_CFD_Init +subroutine FAST_ExtInfw_Init(iTurb, TMax, InputFileName_c, TurbID, OutFileRoot_c, NumSC2CtrlGlob, NumSC2Ctrl, NumCtrl2SC, InitSCOutputsGlob, InitSCOutputsTurbine, NumActForcePtsBlade, NumActForcePtsTower, TurbPosn, AbortErrLev_c, dtDriver_c, dt_c, InflowType, NumBl_c, NumBlElem_c, NumTwrElem_c, NodeClusterType_c, & + ExtInfw_Input_from_FAST, ExtInfw_Output_to_FAST, SC_DX_Input_from_FAST, SC_DX_Output_to_FAST, ErrStat_c, ErrMsg_c) BIND (C, NAME='FAST_ExtInfw_Init') IMPLICIT NONE #ifndef IMPLICIT_DLLEXPORT -!DEC$ ATTRIBUTES DLLEXPORT :: FAST_CFD_Init -!GCC$ ATTRIBUTES DLLEXPORT :: FAST_CFD_Init +!DEC$ ATTRIBUTES DLLEXPORT :: FAST_ExtInfw_Init +!GCC$ ATTRIBUTES DLLEXPORT :: FAST_ExtInfw_Init #endif - INTEGER(C_INT), INTENT(IN ) :: iTurb ! Turbine number - REAL(C_DOUBLE), INTENT(IN ) :: TMax - CHARACTER(KIND=C_CHAR), INTENT(IN ) :: InputFileName_c(IntfStrLen) - INTEGER(C_INT), INTENT(IN ) :: TurbID ! Need not be same as iTurb - INTEGER(C_INT), INTENT(IN ) :: NumSC2CtrlGlob ! Supercontroller global outputs = controller global inputs + INTEGER(C_INT), INTENT(IN ) :: iTurb ! Turbine number + REAL(C_DOUBLE), INTENT(IN ) :: TMax + CHARACTER(KIND=C_CHAR), INTENT(IN ) :: InputFileName_c(IntfStrLen) + INTEGER(C_INT), INTENT(IN ) :: TurbID ! Need not be same as iTurb CHARACTER(KIND=C_CHAR), INTENT( OUT) :: OutFileRoot_c(IntfStrLen) ! Root of output and restart file name - INTEGER(C_INT), INTENT(IN ) :: NumSC2Ctrl ! Supercontroller outputs = controller inputs - INTEGER(C_INT), INTENT(IN ) :: NumCtrl2SC ! controller outputs = Supercontroller inputs - REAL(C_FLOAT), INTENT(IN ) :: InitScOutputsGlob (*) ! Initial Supercontroller global outputs = controller inputs - REAL(C_FLOAT), INTENT(IN ) :: InitScOutputsTurbine (*) ! Initial Supercontroller turbine specific outputs = controller inputs - INTEGER(C_INT), INTENT(IN ) :: NumActForcePtsBlade ! number of actuator line force points in blade - INTEGER(C_INT), INTENT(IN ) :: NumActForcePtsTower ! number of actuator line force points in tower - REAL(C_FLOAT), INTENT(IN ) :: TurbPosn(3) - REAL(C_DOUBLE), INTENT(IN ) :: dtDriver_c - REAL(C_DOUBLE), INTENT( OUT) :: dt_c - INTEGER(C_INT), INTENT( OUT) :: AbortErrLev_c - INTEGER(C_INT), INTENT( OUT) :: InflowType ! inflow type - 1 = From Inflow module, 2 = External - INTEGER(C_INT), INTENT( OUT) :: NumBl_c - INTEGER(C_INT), INTENT( OUT) :: NumBlElem_c - INTEGER(C_INT), INTENT( OUT) :: NumTwrElem_c - TYPE(ExtInfw_InputType_C), INTENT( OUT) :: ExtInfw_Input_from_FAST - TYPE(ExtInfw_OutputType_C),INTENT( OUT) :: ExtInfw_Output_to_FAST + INTEGER(C_INT), INTENT(IN ) :: NumSC2CtrlGlob ! Supercontroller global outputs = controller global inputs + INTEGER(C_INT), INTENT(IN ) :: NumSC2Ctrl ! Supercontroller outputs = controller inputs + INTEGER(C_INT), INTENT(IN ) :: NumCtrl2SC ! controller outputs = Supercontroller inputs + REAL(C_FLOAT), INTENT(IN ) :: InitScOutputsGlob (*) ! Initial Supercontroller global outputs = controller inputs + REAL(C_FLOAT), INTENT(IN ) :: InitScOutputsTurbine (*) ! Initial Supercontroller turbine specific outputs = controller inputs + INTEGER(C_INT), INTENT(IN ) :: NumActForcePtsBlade ! number of actuator line force points in blade + INTEGER(C_INT), INTENT(IN ) :: NumActForcePtsTower ! number of actuator line force points in tower + INTEGER(C_INT), INTENT(IN ):: NodeClusterType_c + REAL(C_FLOAT), INTENT(IN ) :: TurbPosn(3) + INTEGER(C_INT), INTENT( OUT) :: AbortErrLev_c + REAL(C_DOUBLE), INTENT(IN ) :: dtDriver_c + REAL(C_DOUBLE), INTENT( OUT) :: dt_c + INTEGER(C_INT), INTENT( OUT) :: InflowType ! inflow type - 1 = From Inflow module, 2 = External + INTEGER(C_INT), INTENT( OUT) :: NumBl_c + INTEGER(C_INT), INTENT( OUT) :: NumBlElem_c + INTEGER(C_INT), INTENT( OUT) :: NumTwrElem_c + TYPE(ExtInfw_InputType_C), INTENT(INOUT) :: ExtInfw_Input_from_FAST !INTENT(INOUT) instead of INTENT(OUT) to avoid gcc compiler warnings about variable tracking sizes + TYPE(ExtInfw_OutputType_C),INTENT(INOUT) :: ExtInfw_Output_to_FAST !INTENT(INOUT) instead of INTENT(OUT) to avoid gcc compiler warnings about variable tracking sizes TYPE(SC_DX_InputType_C), INTENT(INOUT) :: SC_DX_Input_from_FAST TYPE(SC_DX_OutputType_C), INTENT(INOUT) :: SC_DX_Output_to_FAST - INTEGER(C_INT), INTENT( OUT) :: ErrStat_c - CHARACTER(KIND=C_CHAR), INTENT( OUT) :: ErrMsg_c(IntfStrLen) - + INTEGER(C_INT), INTENT( OUT) :: ErrStat_c + CHARACTER(KIND=C_CHAR), INTENT( OUT) :: ErrMsg_c(IntfStrLen) + ! local - CHARACTER(IntfStrLen) :: InputFileName - INTEGER(C_INT) :: i + CHARACTER(IntfStrLen) :: InputFileName + INTEGER(C_INT) :: i TYPE(FAST_ExternInitType) :: ExternInitData - - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_CFD_Init' - - ! transfer the character array from C to a Fortran string: + + ! transfer the character array from C to a Fortran string: InputFileName = TRANSFER( InputFileName_c, InputFileName ) I = INDEX(InputFileName,C_NULL_CHAR) - 1 ! if this has a c null character at the end... IF ( I > 0 ) InputFileName = InputFileName(1:I) ! remove it - - ! initialize variables: - n_t_global = 0 + + ! initialize variables: + n_t_global = 0 ErrStat = ErrID_None ErrMsg = "" - + NumBl_c = 0 ! initialize here in case of error NumBlElem_c = 0 ! initialize here in case of error - + ExternInitData%TMax = TMax ExternInitData%TurbineID = TurbID ExternInitData%TurbinePos = TurbPosn ExternInitData%SensorType = SensorType_None ExternInitData%NumCtrl2SC = NumCtrl2SC ExternInitData%NumSC2CtrlGlob = NumSC2CtrlGlob - + if ( NumSC2CtrlGlob > 0 ) then CALL AllocAry( ExternInitData%fromSCGlob, NumSC2CtrlGlob, 'ExternInitData%fromSCGlob', ErrStat, ErrMsg) IF (FAILED()) RETURN @@ -678,7 +674,7 @@ subroutine FAST_AL_CFD_Init(iTurb, TMax, InputFileName_c, TurbID, OutFileRoot_c, ExternInitData%fromSCGlob(i) = InitScOutputsGlob(i) end do end if - + ExternInitData%NumSC2Ctrl = NumSC2Ctrl if ( NumSC2Ctrl > 0 ) then CALL AllocAry( ExternInitData%fromSC, NumSC2Ctrl, 'ExternInitData%fromSC', ErrStat, ErrMsg) @@ -688,45 +684,33 @@ subroutine FAST_AL_CFD_Init(iTurb, TMax, InputFileName_c, TurbID, OutFileRoot_c, ExternInitData%fromSC(i) = InitScOutputsTurbine(i) end do end if - + ExternInitData%NumActForcePtsBlade = NumActForcePtsBlade ExternInitData%NumActForcePtsTower = NumActForcePtsTower ExternInitData%DTdriver = dtDriver_c + ExternInitData%NodeClusterType = NodeClusterType_c - CALL FAST_InitializeAll_T( t_initial, 1_IntKi, Turbine(iTurb), ErrStat, ErrMsg, InputFileName, ExternInitData ) + CALL FAST_InitializeAll_T( t_initial, iTurb, Turbine(iTurb), ErrStat, ErrMsg, InputFileName, ExternInitData ) ! set values for return to ExternalInflow - if (ErrStat .ne. ErrID_None) then - AbortErrLev_c = AbortErrLev - ErrStat_c = ErrStat - ErrMsg_c = TRANSFER( TRIM(ErrMsg)//C_NULL_CHAR, ErrMsg_c ) - return - end if - - dt_c = Turbine(iTurb)%p_FAST%dt - - InflowType = Turbine(iTurb)%p_FAST%CompInflow - - if ( (InflowType == 3) .and. (NumActForcePtsBlade .eq. 0) .and. (NumActForcePtsTower .eq. 0) ) then - CALL SetErrStat(ErrID_Warn, "Number of actuator points is zero when inflow type is 2. Mapping of loads may not work. ", ErrStat, ErrMsg, RoutineName ) - end if - - if ( (InflowType .ne. 3) .and. ((NumActForcePtsBlade .ne. 0) .or. (NumActForcePtsTower .ne. 0)) ) then - !!FAST reassigns CompInflow after reading it to a module number based on an internal list in the FAST_Registry. So 2 in input file becomes 3 inside the code. - CALL SetErrStat(ErrID_Fatal, "Number of requested actuator points is non-zero when inflow type is not 2. Please set number of actuator points to zero when induction is turned on.", ErrStat, ErrMsg, RoutineName ) - ErrStat_c = ErrStat - ErrMsg_c = TRANSFER( trim(ErrMsg)//C_NULL_CHAR, ErrMsg_c ) - return - end if - + AbortErrLev_c = AbortErrLev + dt_c = Turbine(iTurb)%p_FAST%dt + ErrStat_c = ErrStat + ErrMsg = TRIM(ErrMsg)//C_NULL_CHAR + ErrMsg_c = TRANSFER( ErrMsg//C_NULL_CHAR, ErrMsg_c ) + + IF ( ErrStat >= AbortErrLev ) THEN + CALL WrScr( "Error in FAST_ExtInfw_Init:FAST_InitializeAll_T" // TRIM(ErrMsg) ) + RETURN + END IF + call SetExternalInflow_pointers(iTurb, ExtInfw_Input_from_FAST, ExtInfw_Output_to_FAST, SC_DX_Input_from_FAST, SC_DX_Output_to_FAST) - - ! 7-Sep-2015: OpenFAST doesn't restrict the number of nodes on each blade mesh to be the same, so if this DOES ever change, - ! we'll need to make ExternalInflow less tied to the AeroDyn mapping. - IF (Turbine(iTurb)%p_FAST%CompAero == MODULE_AD14) THEN + + ! 7-Sep-2015: Sang wants these integers for the ExternalInflow mapping, which is tied to the AeroDyn nodes. FAST doesn't restrict the number of nodes on each + ! blade mesh to be the same, so if this DOES ever change, we'll need to make ExternalInflow less tied to the AeroDyn mapping. + IF (Turbine(iTurb)%p_FAST%CompAero == MODULE_AD14) THEN NumBl_c = SIZE(Turbine(iTurb)%AD14%Input(1)%InputMarkers) NumBlElem_c = Turbine(iTurb)%AD14%Input(1)%InputMarkers(1)%Nnodes - NumTwrElem_c = 0 ! Don't care about Aerodyn14 anymore ELSEIF (Turbine(iTurb)%p_FAST%CompAero == MODULE_AD) THEN IF (ALLOCATED(Turbine(iTurb)%AD%Input(1)%rotors)) THEN IF (ALLOCATED(Turbine(iTurb)%AD%Input(1)%rotors(1)%BladeMotion)) THEN @@ -736,43 +720,34 @@ subroutine FAST_AL_CFD_Init(iTurb, TMax, InputFileName_c, TurbID, OutFileRoot_c, IF (NumBl_c > 0) THEN NumBlElem_c = Turbine(iTurb)%AD%Input(1)%rotors(1)%BladeMotion(1)%Nnodes END IF -!FIXME: need some checks on this. If the Tower mesh is not initialized, this will be garbage - NumTwrElem_c = Turbine(iTurb)%AD%y%rotors(1)%TowerLoad%Nnodes - ELSE - NumBl_c = 0 - NumBlElem_c = 0 - NumTwrElem_c = 0 END IF OutFileRoot_c = TRANSFER( trim(Turbine(iTurb)%p_FAST%OutFileRoot)//C_NULL_CHAR, OutFileRoot_c ) - - ErrStat_c = ErrStat - ErrMsg_c = TRANSFER( trim(ErrMsg)//C_NULL_CHAR, ErrMsg_c ) - - contains + +contains LOGICAL FUNCTION FAILED() - - FAILED = ErrStat >= AbortErrLev - - IF (ErrStat > 0) THEN - CALL WrScr( "Error in FAST_ExtInfw_Init:FAST_InitializeAll_T" // TRIM(ErrMsg) ) - - IF ( FAILED ) THEN - - AbortErrLev_c = AbortErrLev - ErrStat_c = ErrStat - ErrMsg = TRIM(ErrMsg)//C_NULL_CHAR - ErrMsg_c = TRANSFER( ErrMsg//C_NULL_CHAR, ErrMsg_c ) - - !IF (ALLOCATED(Turbine)) DEALLOCATE(Turbine) - ! bjj: if there is an error, the driver should call FAST_DeallocateTurbines() instead of putting this deallocate statement here - END IF - END IF - - + + FAILED = ErrStat >= AbortErrLev + + IF (ErrStat > 0) THEN + CALL WrScr( "Error in FAST_ExtInfw_Init:FAST_InitializeAll_T" // TRIM(ErrMsg) ) + + IF ( FAILED ) THEN + + AbortErrLev_c = AbortErrLev + ErrStat_c = ErrStat + ErrMsg = TRIM(ErrMsg)//C_NULL_CHAR + ErrMsg_c = TRANSFER( ErrMsg//C_NULL_CHAR, ErrMsg_c ) + + !IF (ALLOCATED(Turbine)) DEALLOCATE(Turbine) + ! bjj: if there is an error, the driver should call FAST_DeallocateTurbines() instead of putting this deallocate statement here + END IF + END IF + + END FUNCTION FAILED +end subroutine -end subroutine FAST_AL_CFD_Init !================================================================================================================================== subroutine FAST_CFD_Solution0(iTurb, ErrStat_c, ErrMsg_c) BIND (C, NAME='FAST_CFD_Solution0') IMPLICIT NONE @@ -818,107 +793,88 @@ subroutine FAST_CFD_InitIOarrays_SS(iTurb, ErrStat_c, ErrMsg_c) BIND (C, NAME='F end subroutine FAST_CFD_InitIOarrays_SS !================================================================================================================================== -subroutine FAST_AL_CFD_Restart(iTurb, CheckpointRootName_c, AbortErrLev_c, dt_c, InflowType, numblades_c, & - numElementsPerBlade_c, numElementsTower_c, n_t_global_c, ExtInfw_Input_from_FAST, ExtInfw_Output_to_FAST, & - SC_DX_Input_from_FAST, SC_DX_Output_to_FAST, ErrStat_c, ErrMsg_c) BIND (C, NAME='FAST_AL_CFD_Restart') -!DEC$ ATTRIBUTES DLLEXPORT::FAST_AL_CFD_Restart +subroutine FAST_ExtInfw_Restart(iTurb, CheckpointRootName_c, AbortErrLev_c, dt_c, numblades_c, numElementsPerBlade_c, numElementsTower_c, n_t_global_c, & + ExtInfw_Input_from_FAST, ExtInfw_Output_to_FAST, SC_DX_Input_from_FAST, SC_DX_Output_to_FAST, ErrStat_c, ErrMsg_c) BIND (C, NAME='FAST_ExtInfw_Restart') IMPLICIT NONE #ifndef IMPLICIT_DLLEXPORT -!DEC$ ATTRIBUTES DLLEXPORT :: FAST_AL_CFD_Restart -!GCC$ ATTRIBUTES DLLEXPORT :: FAST_AL_CFD_Restart +!DEC$ ATTRIBUTES DLLEXPORT :: FAST_ExtInfw_Restart +!GCC$ ATTRIBUTES DLLEXPORT :: FAST_ExtInfw_Restart #endif - INTEGER(C_INT), INTENT(IN ) :: iTurb ! Turbine number - CHARACTER(KIND=C_CHAR), INTENT(IN ) :: CheckpointRootName_c(IntfStrLen) - INTEGER(C_INT), INTENT( OUT) :: AbortErrLev_c - INTEGER(C_INT), INTENT( OUT) :: numblades_c - INTEGER(C_INT), INTENT( OUT) :: numElementsPerBlade_c - INTEGER(C_INT), INTENT( OUT) :: numElementsTower_c - REAL(C_DOUBLE), INTENT( OUT) :: dt_c - INTEGER(C_INT), INTENT( OUT) :: InflowType - INTEGER(C_INT), INTENT( OUT) :: n_t_global_c - TYPE(ExtInfw_InputType_C), INTENT( OUT) :: ExtInfw_Input_from_FAST - TYPE(ExtInfw_OutputType_C),INTENT( OUT) :: ExtInfw_Output_to_FAST + INTEGER(C_INT), INTENT(IN ) :: iTurb ! Turbine number + CHARACTER(KIND=C_CHAR), INTENT(IN ) :: CheckpointRootName_c(IntfStrLen) + INTEGER(C_INT), INTENT( OUT) :: AbortErrLev_c + INTEGER(C_INT), INTENT( OUT) :: numblades_c + INTEGER(C_INT), INTENT( OUT) :: numElementsPerBlade_c + INTEGER(C_INT), INTENT( OUT) :: numElementsTower_c + REAL(C_DOUBLE), INTENT( OUT) :: dt_c + INTEGER(C_INT), INTENT( OUT) :: n_t_global_c + TYPE(ExtInfw_InputType_C), INTENT(INOUT) :: ExtInfw_Input_from_FAST !INTENT(INOUT) instead of INTENT(OUT) to avoid gcc compiler warnings about variable tracking sizes + TYPE(ExtInfw_OutputType_C),INTENT(INOUT) :: ExtInfw_Output_to_FAST !INTENT(INOUT) instead of INTENT(OUT) to avoid gcc compiler warnings about variable tracking sizes TYPE(SC_DX_InputType_C), INTENT(INOUT) :: SC_DX_Input_from_FAST TYPE(SC_DX_OutputType_C), INTENT(INOUT) :: SC_DX_Output_to_FAST - INTEGER(C_INT), INTENT( OUT) :: ErrStat_c - CHARACTER(KIND=C_CHAR), INTENT( OUT) :: ErrMsg_c(IntfStrLen) - + INTEGER(C_INT), INTENT( OUT) :: ErrStat_c + CHARACTER(KIND=C_CHAR), INTENT( OUT) :: ErrMsg_c(IntfStrLen) + ! local variables - INTEGER(C_INT) :: NumOuts_c - CHARACTER(IntfStrLen) :: CheckpointRootName + INTEGER(C_INT) :: NumOuts_c + CHARACTER(IntfStrLen) :: CheckpointRootName INTEGER(IntKi) :: I INTEGER(IntKi) :: Unit REAL(DbKi) :: t_initial_out INTEGER(IntKi) :: NumTurbines_out - CHARACTER(*), PARAMETER :: RoutineName = 'FAST_Restart' - + CHARACTER(*), PARAMETER :: RoutineName = 'FAST_Restart' + CALL NWTC_Init() - ! transfer the character array from C to a Fortran string: + ! transfer the character array from C to a Fortran string: CheckpointRootName = TRANSFER( CheckpointRootName_c, CheckpointRootName ) I = INDEX(CheckpointRootName,C_NULL_CHAR) - 1 ! if this has a c null character at the end... IF ( I > 0 ) CheckpointRootName = CheckpointRootName(1:I) ! remove it - + Unit = -1 CALL FAST_RestoreFromCheckpoint_T(t_initial_out, n_t_global, NumTurbines_out, Turbine(iTurb), CheckpointRootName, ErrStat, ErrMsg, Unit ) - + ! check that these are valid: IF (t_initial_out /= t_initial) CALL SetErrStat(ErrID_Fatal, "invalid value of t_initial.", ErrStat, ErrMsg, RoutineName ) IF (NumTurbines_out /= 1) CALL SetErrStat(ErrID_Fatal, "invalid value of NumTurbines.", ErrStat, ErrMsg, RoutineName ) - - ! transfer Fortran variables to C: + + ! transfer Fortran variables to C: n_t_global_c = n_t_global - AbortErrLev_c = AbortErrLev - NumOuts_c = min(MAXOUTPUTS, 1 + SUM( Turbine(iTurb)%y_FAST%numOuts )) ! includes time - + AbortErrLev_c = AbortErrLev + NumOuts_c = min(MAXOUTPUTS, SUM( Turbine(iTurb)%y_FAST%numOuts )) ! includes time if (allocated(Turbine(iTurb)%ad%p%rotors)) then ! this might not be allocated if we had an error earlier numBlades_c = Turbine(iTurb)%ad%p%rotors(1)%numblades numElementsPerBlade_c = Turbine(iTurb)%ad%p%rotors(1)%numblnds ! I'm not sure if FASTv8 can handle different number of blade nodes for each blade. - numElementsTower_c = Turbine(iTurb)%ad%y%rotors(1)%TowerLoad%Nnodes else numBlades_c = 0 numElementsPerBlade_c = 0 - numElementsTower_c = 0 end if - dt_c = Turbine(iTurb)%p_FAST%dt - + numElementsTower_c = Turbine(iTurb)%ad%p%rotors(1)%numtwrnds + + dt_c = Turbine(iTurb)%p_FAST%dt + ErrStat_c = ErrStat ErrMsg = TRIM(ErrMsg)//C_NULL_CHAR ErrMsg_c = TRANSFER( ErrMsg//C_NULL_CHAR, ErrMsg_c ) -#ifdef CONSOLE_FILE - if (ErrStat .ne. ErrID_None) call wrscr1(trim(ErrMsg)) -#endif +#ifdef CONSOLE_FILE + if (ErrStat /= ErrID_None) call wrscr1(trim(ErrMsg)) +#endif if (ErrStat >= AbortErrLev) return - - call SetExternalInflow_pointers(iTurb, ExtInfw_Input_from_FAST, ExtInfw_Output_to_FAST, SC_DX_Input_from_FAST, SC_DX_Output_to_FAST) - - InflowType = Turbine(iTurb)%p_FAST%CompInflow - - if (ErrStat .ne. ErrID_None) then - call wrscr1(trim(ErrMsg)) - return - end if - - if (dt_c == Turbine(iTurb)%p_FAST%dt) then - CALL SetErrStat(ErrID_Fatal, "Time step specified in C++ API does not match with time step specified in OpenFAST input file.", ErrStat, ErrMsg, RoutineName ) - return - end if - + call SetExternalInflow_pointers(iTurb, ExtInfw_Input_from_FAST, ExtInfw_Output_to_FAST, SC_DX_Input_from_FAST, SC_DX_Output_to_FAST) -end subroutine FAST_AL_CFD_Restart - +end subroutine FAST_ExtInfw_Restart !================================================================================================================================== -subroutine FAST_BR_CFD_Restart(iTurb, CheckpointRootName_c, AbortErrLev_c, dt_c, numblades_c, & +subroutine FAST_ExtLoads_Restart(iTurb, CheckpointRootName_c, AbortErrLev_c, dt_c, numblades_c, & n_t_global_c, ExtLd_Input_from_FAST, ExtLd_Output_to_FAST, & - SC_DX_Input_from_FAST, SC_DX_Output_to_FAST, ErrStat_c, ErrMsg_c) BIND (C, NAME='FAST_BR_CFD_Restart') -!DEC$ ATTRIBUTES DLLEXPORT::FAST_BR_CFD_Restart + SC_DX_Input_from_FAST, SC_DX_Output_to_FAST, ErrStat_c, ErrMsg_c) BIND (C, NAME='FAST_ExtLoads_Restart') +!DEC$ ATTRIBUTES DLLEXPORT::FAST_ExtLoads_Restart IMPLICIT NONE #ifndef IMPLICIT_DLLEXPORT -!DEC$ ATTRIBUTES DLLEXPORT :: FAST_BR_CFD_Restart -!GCC$ ATTRIBUTES DLLEXPORT :: FAST_BR_CFD_Restart +!DEC$ ATTRIBUTES DLLEXPORT :: FAST_ExtLoads_Restart +!GCC$ ATTRIBUTES DLLEXPORT :: FAST_ExtLoads_Restart #endif INTEGER(C_INT), INTENT(IN ) :: iTurb ! Turbine number CHARACTER(KIND=C_CHAR), INTENT(IN ) :: CheckpointRootName_c(IntfStrLen) @@ -988,7 +944,7 @@ subroutine FAST_BR_CFD_Restart(iTurb, CheckpointRootName_c, AbortErrLev_c, dt_c, ErrStat_c = ErrStat ErrMsg_c = TRANSFER( trim(ErrMsg)//C_NULL_CHAR, ErrMsg_c ) -end subroutine FAST_BR_CFD_Restart +end subroutine FAST_ExtLoads_Restart !================================================================================================================================== subroutine SetExtLoads_pointers(iTurb, ExtLd_iFromOF, ExtLd_oToOF) diff --git a/modules/openfast-library/src/FAST_Library.h b/modules/openfast-library/src/FAST_Library.h index aa8ccb6005..51269339f0 100644 --- a/modules/openfast-library/src/FAST_Library.h +++ b/modules/openfast-library/src/FAST_Library.h @@ -16,24 +16,19 @@ EXTERNAL_ROUTINE void FAST_AllocateTurbines(int * iTurb, int *ErrStat, char *ErrMsg); EXTERNAL_ROUTINE void FAST_DeallocateTurbines(int *ErrStat, char *ErrMsg); -EXTERNAL_ROUTINE void FAST_AL_CFD_Restart(int * iTurb, const char *CheckpointRootName, int *AbortErrLev, - double * dt, int * InflowType, int * NumBl, int * NumBlElem, int * NumTwrElem, int * n_t_global, - ExtInfw_InputType_t* ExtInfw_Input, ExtInfw_OutputType_t* ExtInfw_Output, - SC_DX_InputType_t* SC_DX_Input, SC_DX_OutputType_t* SC_DX_Output, - int *ErrStat, char *ErrMsg); -EXTERNAL_ROUTINE void FAST_AL_CFD_Init(int * iTurb, double *TMax, const char *InputFileName, - int * TurbineID, char *OutFileRoot, - int * NumSC2CtrlGlob, int * NumSC2Ctrl, int * NumCtrl2SC, - float * initSCInputsGlob, float * initSCInputsTurbine, - int * NumActForcePtsBlade, int * NumActForcePtsTower, float * TurbinePosition, - int *AbortErrLev, double * dtDriver, double * dt, int * InflowType, - int * NumBl, int * NumBlElem, int * NumTwrElem, - ExtInfw_InputType_t* ExtInfw_Input, ExtInfw_OutputType_t* ExtInfw_Output, - SC_DX_InputType_t* SC_DX_Input, SC_DX_OutputType_t* SC_DX_Output, - int *ErrStat, char *ErrMsg); +EXTERNAL_ROUTINE void FAST_ExtInfw_Restart(int * iTurb, const char *CheckpointRootName, int *AbortErrLev, double * dt, int * InflowType, + int * NumBl, int * NumBlElem, int * NumTwrElem, int * n_t_global, + ExtInfw_InputType_t* ExtInfw_Input, ExtInfw_OutputType_t* ExtInfw_Output, SC_DX_InputType_t* SC_DX_Input, SC_DX_OutputType_t* SC_DX_Output, + int *ErrStat, char *ErrMsg); +EXTERNAL_ROUTINE void FAST_ExtInfw_Init(int * iTurb, double *TMax, const char *InputFileName, int * TurbineID, char *OutFileRoot, + int * NumSC2CtrlGlob, int * NumSC2Ctrl, int * NumCtrl2SC, float * initSCInputsGlob, float * initSCInputsTurbine, + int * NumActForcePtsBlade, int * NumActForcePtsTower, float * TurbinePosition, int *AbortErrLev, + double * dtDriver, double * dt, int * InflowType, int * NumBl, int * NumBlElem, int * NumTwrElem, int * NodeClusterType, + ExtInfw_InputType_t* ExtInfw_Input, ExtInfw_OutputType_t* ExtInfw_Output, SC_DX_InputType_t* SC_DX_Input, SC_DX_OutputType_t* SC_DX_Output, + int *ErrStat, char *ErrMsg); -EXTERNAL_ROUTINE void FAST_BR_CFD_Restart(int * iTurb, const char *CheckpointRootName, int *AbortErrLev, double * dt, int * NumBl, int * n_t_global, ExtLdDX_InputType_t* ExtLdDX_Input, ExtLdDX_OutputType_t* ExtLdDX_Output, SC_DX_InputType_t* SC_DX_Input, SC_DX_OutputType_t* SC_DX_Output, int *ErrStat, char *ErrMsg); -EXTERNAL_ROUTINE void FAST_BR_CFD_Init(int * iTurb, double *TMax, const char *InputFileName, int * TurbineID, char *OutFileRoot, float * TurbinePosition, int *AbortErrLev, double * dtDriver, double * dt, int * NumBl, double * az_blend_mean, double * az_blend_delta, double * vel_mean, double * wind_dir, double * z_ref, double * shear_exp, ExtLdDX_InputType_t* ExtLdDX_Input, ExtLdDX_OutputType_t* ExtLdDX_Output, SC_DX_InputType_t* SC_DX_Input, SC_DX_OutputType_t* SC_DX_Output, int *ErrStat, char *ErrMsg); +EXTERNAL_ROUTINE void FAST_ExtLoads_Restart(int * iTurb, const char *CheckpointRootName, int *AbortErrLev, double * dt, int * NumBl, int * n_t_global, ExtLdDX_InputType_t* ExtLdDX_Input, ExtLdDX_OutputType_t* ExtLdDX_Output, SC_DX_InputType_t* SC_DX_Input, SC_DX_OutputType_t* SC_DX_Output, int *ErrStat, char *ErrMsg); +EXTERNAL_ROUTINE void FAST_ExtLoads_Init(int * iTurb, double *TMax, const char *InputFileName, int * TurbineID, char *OutFileRoot, float * TurbinePosition, int *AbortErrLev, double * dtDriver, double * dt, int * NumBl, double * az_blend_mean, double * az_blend_delta, double * vel_mean, double * wind_dir, double * z_ref, double * shear_exp, ExtLdDX_InputType_t* ExtLdDX_Input, ExtLdDX_OutputType_t* ExtLdDX_Output, SC_DX_InputType_t* SC_DX_Input, SC_DX_OutputType_t* SC_DX_Output, int *ErrStat, char *ErrMsg); EXTERNAL_ROUTINE void FAST_CFD_Solution0(int * iTurb, int *ErrStat, char *ErrMsg); EXTERNAL_ROUTINE void FAST_CFD_InitIOarrays_SS(int * iTurb, int *ErrStat, char *ErrMsg); EXTERNAL_ROUTINE void FAST_CFD_Prework(int * iTurb, int *ErrStat, char *ErrMsg);