def test_variable_assign(): var = Variable(name='test') var.assign(value=1.0, lower=-1.0, upper=2.0, scaling=3.0, active=False, coupled=True) assert var.value == 1.0 assert var.lower == -1.0 assert var.upper == 2.0 assert var.scaling == 3.0 assert var.active == False assert var.coupled == True
def create_body(): body = Body(name='test body', id = 1, group = 2, boundary = 3, fun3d = False, motion_type='deform+rigid') body.update_id var = Variable(name='var 1',value = 0.0, active = True, coupled = False) body.add_variable('aerodynamic',var) var2 = Variable(name='var 2',value = 1.0, active = True, coupled = True) body.add_variable('aerodynamic',var2) var3 = Variable(name='var 3',value = 1.0,active = False, coupled = False) body.add_variable('structural',var3) return body
def test_variable(): var = Variable(name='test', value=1.0, lower=-1.0, upper=2.0, scaling=3.0, active=False, coupled=True, id=4) assert var.name == 'test' assert var.value == 1.0 assert var.lower == -1.0 assert var.upper == 2.0 assert var.scaling == 3.0 assert var.active == False assert var.coupled == True assert var.id == 4
airfoil = Body('airfoil', group=0, boundary=1, motion_type='deform') model.add_body(airfoil) # Define scenario and design variables scenario = Scenario('forward_flight', group=0, steps=steps, steady=False) # Add the dynamic pressure variable as both aerodynamic and # structural qinf0 = 10000.0 lower = 5000.0 upper = 1.0e6 # Set the time step as the only structural design variables struct_dt = Variable('struct_dt', value=1e-4, lower=0.0, upper=1.0, scaling=1.0) scenario.add_variable('structural', struct_dt) # Define the objective objective = Function('pitch damping estimate', analysis_type='structural', averaging=False, start=0, stop=-1) scenario.add_function(objective) model.add_scenario(scenario) # Instantiate the flow solver