def __init__(self, solvers, comm, struct_comm, struct_master, aero_comm, aero_master, transfer_options=None, model=None): """ Parameters ---------- solvers: dict the various disciplinary solvers comm: MPI.comm MPI communicator transfer_options: dict options of the load and displacement transfer scheme model: :class:`~funtofem_model.FUNtoFEMmodel` The model containing the design data """ # communicator self.comm = comm self.aero_comm = aero_comm self.aero_master = aero_master self.struct_comm = struct_comm self.struct_master = struct_master # Solver classes self.solvers = solvers # Make a fake model if not given one if model is not None: self.fakemodel = False else: print("FUNtoFEM driver: generating fake model") from pyfuntofem.model import FUNtoFEMmodel, Body, Scenario, Function model = FUNtoFEMmodel('fakemodel') fakebody = Body('fakebody') model.add_body(fakebody) fakescenario = Scenario('fakescenario') function = Function('cl', analysis_type='aerodynamic') fakescenario.add_function(function) model.add_scenario(fakescenario) self.fakemodel = True self.model = model # Initialize transfer scheme self._initialize_transfer(transfer_options) # Initialize the shape parameterization for body in self.model.bodies: if body.shape: body.initialize_shape_parameterization()
def test_body(): body = Body(name='test body', id = 1, group = 2, boundary = 3, fun3d = False, motion_type='deform+rigid') assert body.name == 'test body' assert body.id == 1 assert body.group == 2 assert body.boundary == 3 assert body.motion_type == 'deform+rigid'
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_body(self): body = Body(name='test body', id=1, group=2, boundary=3, fun3d=False, motion_type='deform+rigid', analysis_type='aeroelastic') assert body.name == 'test body' assert body.id == 1 assert body.group == 2 assert body.boundary == 3 assert body.motion_type == 'deform+rigid'
use_test_function = False # Parse command line arguments for modifying the number of steps p = argparse.ArgumentParser() p.add_argument('--num_steps', type=int, default=1000) p.add_argument('--use_test_function', action='store_true', default=False) args = p.parse_args() steps = args.num_steps use_test_function = args.use_test_function print('num_steps = ', steps) print('use_test_function = ', use_test_function) model = FUNtoFEMmodel('spring-mounted airfoil') 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,