class turbsimGroup(Group): def __init__(self): super(turbsimGroup, self).__init__() self.reader = turbsimReader() self.writer = TurbsimBuilder() self.wrapper = Turbsim_wrapper() self.run_dir = self.writer.run_dir def execute(self): #def solve_nonlinear(self, params, unknowns, resids): if not os.path.exists(self.run_dir): os.makedirs(self.run_dir) self.writer.run_dir = self.run_dir self.reader.run_dir = self.run_dir self.wrapper.run_dir = self.run_dir self.writer.turbsim_vt = self.reader.turbsim_vt self.writer.execute() self.wrapper.execute()
def __init__(self, config, case): """ A FAST component that executes the workflow. Takes a single dictionary, config, as well as a case name as the input. Executes FAST workflow in the associated case running directory. """ super(TurbsimWorkflow, self).__init__() # Initialize objects self.reader = turbsimReader() self.writer = TurbsimBuilder() self.wrapper = Turbsim_wrapper() for key in config: if key == 'Turbsim_masterfile': self.reader.Turbsim_masterfile = config[key] #print self.reader.Turbsim_masterfile elif key == 'Turbsim_masterdir': self.reader.Turbsim_masterdir = config[key] #print self.reader.Turbsim_masterdir elif key == 'Turbsim_runfile': self.writer.Turbsim_runfile = config[key] #print self.writer.Turbsim_runfile elif key == 'Turbsim_rundir': self.writer.Turbsim_rundir = config[key] #print self.writer.Turbsim_rundir elif key == 'Turbsim_exe': self.wrapper.Turbsim_exe = config[key] #print self.wrapper.Turbsim_exe self.reader.execute() #Read/populate vartrees self.writer.turbsim_vt = self.reader.turbsim_vt #Pass vartrees from reader to write self.writer.InputConfig( **config) #Edit vartrees according to keys in config dictionary # Pass file and directory names from writer to wrapper self.wrapper.Turbsim_runfile = self.writer.Turbsim_runfile self.wrapper.Turbsim_rundir = self.writer.Turbsim_rundir
def execute(self, IEC_WindType, Uref, ver='Turbsim'): self.IEC_WindType = IEC_WindType self.Uref = Uref turbsim_vt = self.setup() writer = TurbsimBuilder() if ver.lower() == 'turbsim': wrapper = Turbsim_wrapper() if ver.lower() =='pyturbsim': wrapper = pyTurbsim_wrapper() # if self.case_name[-3:] != '.in': # self.case_name = self.case_name + '.in' # self.case_name += '_U%1.1f'%self.Uref + '_Seed%1.1f'%self.seed # self.case_name += '_U%d'%self.Uref + '_Seed%d.in'%self.seed case_name = self.case_name + '_U%1.6f'%self.Uref + '_Seed%1.1f'%self.seed tsim_input_file = case_name + '.in' wind_file_out = case_name + '.bts' # If wind file already exists and overwriting is turned off, skip wind file write if os.path.exists(os.path.join(self.outdir, wind_file_out)) and not self.overwrite: return wind_file_out, 3 # Run wind file generation else: writer.turbsim_vt = turbsim_vt writer.run_dir = self.outdir writer.tsim_input_file = tsim_input_file writer.execute() wrapper.turbsim_input = os.path.realpath(os.path.join(writer.run_dir, writer.tsim_input_file)) wrapper.run_dir = writer.run_dir wrapper.turbsim_exe = self.Turbsim_exe wrapper.debug_level = self.debug_level wrapper.execute() return wind_file_out, 3
class TurbsimWorkflow(Component): """ An OpenMDAO Component for running the FST (FAST) workflow This class is a basic workflow utlizing the FST reader, writer, and wrapper in OpenMDAO. User is expected to subclass or modify this class to enable OpenMDAO-style connectivity to FAST variables of interest.""" def __init__(self, config, case): """ A FAST component that executes the workflow. Takes a single dictionary, config, as well as a case name as the input. Executes FAST workflow in the associated case running directory. """ super(TurbsimWorkflow, self).__init__() # Initialize objects self.reader = turbsimReader() self.writer = TurbsimBuilder() self.wrapper = Turbsim_wrapper() for key in config: if key == 'Turbsim_masterfile': self.reader.Turbsim_masterfile = config[key] #print self.reader.Turbsim_masterfile elif key == 'Turbsim_masterdir': self.reader.Turbsim_masterdir = config[key] #print self.reader.Turbsim_masterdir elif key == 'Turbsim_runfile': self.writer.Turbsim_runfile = config[key] #print self.writer.Turbsim_runfile elif key == 'Turbsim_rundir': self.writer.Turbsim_rundir = config[key] #print self.writer.Turbsim_rundir elif key == 'Turbsim_exe': self.wrapper.Turbsim_exe = config[key] #print self.wrapper.Turbsim_exe self.reader.execute() #Read/populate vartrees self.writer.turbsim_vt = self.reader.turbsim_vt #Pass vartrees from reader to write self.writer.InputConfig( **config) #Edit vartrees according to keys in config dictionary # Pass file and directory names from writer to wrapper self.wrapper.Turbsim_runfile = self.writer.Turbsim_runfile self.wrapper.Turbsim_rundir = self.writer.Turbsim_rundir #print 'check wrapper rundir' #print self.wrapper.Turbsim_rundir #print 'writer rundir' #print self.writer.Turbsim_rundir #print 'check wrapper runfile' #print self.wrapper.Turbsim_runfile #print 'writer runfile' #print self.writer.Turbsim_runfile def solve_nonlinear(self, params, unknowns, resids): # Create running directory if it doesn't exist if not os.path.isdir(self.writer.Turbsim_rundir): os.makedirs(self.writer.Turbsim_rundir) # Write new analysis files self.writer.execute() # Execute analysis self.wrapper.execute()
from AeroelasticSE.Turbsim_mdao.turbsim_writer import TurbsimBuilder from AeroelasticSE.Turbsim_mdao.turbsim_wrapper import Turbsim_wrapper from AeroelasticSE.Turbsim_mdao.turbsim_reader import turbsimReader reader = turbsimReader() writer = TurbsimBuilder() wrapper = Turbsim_wrapper() reader.read_input_file('TurbsimInputFiles/test01.inp') writer.turbsim_vt = reader.turbsim_vt writer.turbsim_vt.spatialcoherance.CohExp = 0.1 writer.turbulence_template = 'TurbsimInputFiles/turbulence_user.inp' writer.run_dir = 'test' writer.execute() wrapper.run_dir = writer.run_dir wrapper.turbsim_exe = 'TurbSim_x64.exe' wrapper.execute()
def __init__(self): super(turbsimGroup, self).__init__() self.reader = turbsimReader() self.writer = TurbsimBuilder() self.wrapper = Turbsim_wrapper() self.run_dir = self.writer.run_dir
from AeroelasticSE.Turbsim_mdao.turbsim_writer import TurbsimBuilder from AeroelasticSE.Turbsim_mdao.turbsim_wrapper import Turbsim_wrapper from AeroelasticSE.Turbsim_mdao.turbsim_reader import turbsimReader reader = turbsimReader() writer = TurbsimBuilder() wrapper = Turbsim_wrapper() reader.read_input_file('TurbsimInputFiles/test01.inp') writer.turbsim_vt = reader.turbsim_vt writer.turbsim_vt.spatialcoherance.CohExp = 0.1 writer.turbulence_template = 'TurbsimInputFiles/turbulence_user.inp' writer.run_dir = 'test' writer.execute() wrapper.run_dir = writer.run_dir wrapper.turbsim_exe = '/Users/jquick/SE/TurbSim/bin/TurbSim_glin64' wrapper.execute()