コード例 #1
0
def callturbsim(mean_wind_speed, turbulence_intensity):

    ts = runTurbSim()
    ts.ts_exe = "/home/sebasanper/Downloads/turbsim/turbsim/TurbSim"

    # abs path
    ts.ts_dir = "/home/sebasanper/PycharmProjects/owf_MDAO/aero_loads_models/"
    ts.ts_file = "TurbSim.inp"

    # relative path
    #    ts.ts_dir = "TurbSimTest"
    #    ts.ts_file = "turbsim_template.inp"

    ts.run_dir = "/home/sebasanper/PycharmProjects/owf_MDAO/aero_loads_models/turbsim_test_run"
    ts.set_dict({
        "URef": mean_wind_speed,
        "AnalysisTime": 600,
        "UsableTime": 100,
        "IECturbc": turbulence_intensity
    })
    ts.execute()

    with open(
            '/home/sebasanper/PycharmProjects/owf_MDAO/aero_loads_models/turbsim_test_run/TurbSim.sum',
            'r') as files:
        filedata = files.read()

    # Replace the target string
    filedata = filedata.replace('87.700', '87.600')

    # Write the file out again
    with open(
            '/home/sebasanper/PycharmProjects/owf_MDAO/aero_loads_models/turbsim_test_run/TurbSim.sum',
            'w') as files:
        files.write(filedata)
コード例 #2
0
ファイル: runFAST.py プロジェクト: aherrema/AeroelasticSE
def turbsim_example():
    """ A simple example of first running `TurbSim`, then running FAST """ 
    # run TurbSim
    from runTurbSim import runTurbSim

    ts = runTurbSim()
    ts.ts_exe = "/Users/pgraf/opt/windcode-7.31.13/TurbSim/build/TurbSim_glin64"
    ts.run_dir = "turbsim_test_run"
    tscase = 2
    if (tscase == 1):
        ts.ts_dir = "TurbSimTest"
        ts.ts_file = "turbsim_template.inp"
    else:
        ts.ts_dir = "/Users/pgraf/work/wese/fatigue12-13/from_gordie/SparFAST3.orig/TurbSim"
        ts.ts_file = "TurbSim.inp"
        
    tmax = 12
    ws=20.0 # wind speed

    ts.set_dict({"URef": ws, "AnalysisTime":tmax, "UsableTime":tmax})
    ts.execute()

    # then run FAST
    fast = runFAST()
    fast.fst_exe = "/Users/pgraf/opt/windcode-7.31.13/build/FAST_glin64"
    case = 2
    if (case==1):
        fast.fst_dir = "FAST_VT/OC3_Files/"
        fast.fst_file = "NRELOffshrBsline5MW_Monopile_RF.fst" 
    elif case ==2:
        fast.fst_dir = "/Users/pgraf/work/wese/fatigue12-13/from_gordie/SparFAST3.orig"
        fast.fst_file = "NRELOffshrBsline5MW_Floating_OC3Hywind.fst"
    else:
        fast.fst_dir = "InputFilesToWrite/"
        fast.fst_file = "NREL5MW_Monopile_Rigid.v7.02.fst"

    fast.run_dir = "tsfast_test_run_dir"  ## either abs or rel path ok

    # here we link turbsim -> fast
    tswind_file = os.path.join(ts.ts_dir, "%s.wnd" % ts.run_name)
    fast.set_wind_file(os.path.abspath(tswind_file))

    fast.fstDict['Vhub']=ws
    fast.fstDict['RotSpeed'] = 12.03
    fast.fstDict["TMax"] = tmax
    fast.fstDict['TStart'] = 0.0

    fast.setOutputs(['RotPwr'])

    fast.execute()

    out = fast.getOutputValue("RotPwr")

    print "TurbSim example complete:"
    print "max power"
    print max(out)
コード例 #3
0
ファイル: runFAST.py プロジェクト: xiaoyao79/AeroelasticSE
def turbsim_example():
    """ A simple example of first running `TurbSim`, then running FAST """
    # run TurbSim
    from runTurbSim import runTurbSim

    ts = runTurbSim()
    ts.ts_exe = "/Users/pgraf/opt/windcode-7.31.13/TurbSim/build/TurbSim_glin64"
    ts.run_dir = "turbsim_test_run"
    tscase = 2
    if (tscase == 1):
        ts.ts_dir = "TurbSimTest"
        ts.ts_file = "turbsim_template.inp"
    else:
        ts.ts_dir = "/Users/pgraf/work/wese/fatigue12-13/from_gordie/SparFAST3.orig/TurbSim"
        ts.ts_file = "TurbSim.inp"

    tmax = 12
    ws = 20.0  # wind speed

    ts.set_dict({"URef": ws, "AnalysisTime": tmax, "UsableTime": tmax})
    ts.execute()

    # then run FAST
    fast = runFAST()
    fast.fst_exe = "/Users/pgraf/opt/windcode-7.31.13/build/FAST_glin64"
    case = 2
    if (case == 1):
        fast.fst_dir = "FAST_VT/OC3_Files/"
        fast.fst_file = "NRELOffshrBsline5MW_Monopile_RF.fst"
    elif case == 2:
        fast.fst_dir = "/Users/pgraf/work/wese/fatigue12-13/from_gordie/SparFAST3.orig"
        fast.fst_file = "NRELOffshrBsline5MW_Floating_OC3Hywind.fst"
    else:
        fast.fst_dir = "InputFilesToWrite/"
        fast.fst_file = "NREL5MW_Monopile_Rigid.v7.02.fst"

    fast.run_dir = "tsfast_test_run_dir"  ## either abs or rel path ok

    # here we link turbsim -> fast
    tswind_file = os.path.join(ts.ts_dir, "%s.wnd" % ts.run_name)
    fast.set_wind_file(os.path.abspath(tswind_file))

    fast.fstDict['Vhub'] = ws
    fast.fstDict['RotSpeed'] = 12.03
    fast.fstDict["TMax"] = tmax
    fast.fstDict['TStart'] = 0.0

    fast.setOutputs(['RotPwr'])

    fast.execute()

    out = fast.getOutputValue("RotPwr")

    print "TurbSim example complete:"
    print "max power"
    print max(out)
コード例 #4
0
ファイル: FusedFAST.py プロジェクト: WISDEM/AeroelasticSE
    def __init__(self, filedict):
        super(runTurbSimext,self).__init__()
        self.rawts = runTurbSim()
    
        self.rawts.ts_exe = filedict['ts_exe']
        self.rawts.ts_dir = filedict['ts_dir']
        self.rawts.ts_file = filedict['ts_file']
#        self.rawts.run_name = self.run_name

        self.basedir = os.path.join(os.getcwd(),"allts_runs")
        if 'run_dir' in filedict:
            self.basedir = os.path.join(os.getcwd(),filedict['run_dir'])
        if (not os.path.exists(self.basedir)):
            os.mkdir(self.basedir)
コード例 #5
0
    def __init__(self, filedict):
        super(runTurbSimext, self).__init__()
        self.rawts = runTurbSim()

        self.rawts.ts_exe = filedict['ts_exe']
        self.rawts.ts_dir = filedict['ts_dir']
        self.rawts.ts_file = filedict['ts_file']
        #        self.rawts.run_name = self.run_name

        self.basedir = os.path.join(os.getcwd(), "allts_runs")
        if 'run_dir' in filedict:
            self.basedir = os.path.join(os.getcwd(), filedict['run_dir'])
        if (not os.path.exists(self.basedir)):
            os.mkdir(self.basedir)