Skip to content

Commit

Permalink
change full_name properties to use scenario-name not scenario.name
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-engelstad committed Nov 1, 2023
1 parent d93a0cb commit 38003e8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
16 changes: 11 additions & 5 deletions examples/framework/tacs_oneway_naca_wing/1_tacs_sizing_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
tacs_aim = tacs_model.tacs_aim

aluminum = caps2tacs.Isotropic.aluminum().register_to(tacs_model)
aluminum_stringer = caps2tacs.Orthotropic.smeared_stringer(
aluminum, area_ratio=0.5
).register_to(tacs_model)

# setup the thickness design variables + automatic shell properties
# using Composite functions, this part has to go after all funtofem variables are defined...
Expand All @@ -43,7 +46,7 @@
for irib in range(1, nribs + 1):
name = f"rib{irib}"
caps2tacs.ShellProperty(
caps_group=name, material=aluminum, membrane_thickness=init_thickness
caps_group=name, material=aluminum_stringer, membrane_thickness=init_thickness
).register_to(tacs_model)
Variable.structural(name, value=init_thickness).set_bounds(
lower=0.01, upper=0.2, scale=100.0
Expand All @@ -52,7 +55,7 @@
for ispar in range(1, nspars + 1):
name = f"spar{ispar}"
caps2tacs.ShellProperty(
caps_group=name, material=aluminum, membrane_thickness=init_thickness
caps_group=name, material=aluminum_stringer, membrane_thickness=init_thickness
).register_to(tacs_model)
Variable.structural(name, value=init_thickness).set_bounds(
lower=0.01, upper=0.2, scale=100.0
Expand All @@ -61,7 +64,7 @@
for iOML in range(1, nOML + 1):
name = f"OML{iOML}"
caps2tacs.ShellProperty(
caps_group=name, material=aluminum, membrane_thickness=init_thickness
caps_group=name, material=aluminum_stringer, membrane_thickness=init_thickness
).register_to(tacs_model)
Variable.structural(name, value=init_thickness).set_bounds(
lower=0.01, upper=0.2, scale=100.0
Expand Down Expand Up @@ -149,12 +152,15 @@
prob = om.Problem()

# Create the OpenMDAO component using the built-in Funtofem component
f2f_subsystem = FuntofemComponent(driver=tacs_driver, write_dir=tacs_aim.analysis_dir)
design_out_file = "design-stringer.txt"
f2f_subsystem = FuntofemComponent(
driver=tacs_driver, write_dir=tacs_aim.analysis_dir, design_out_file=design_out_file
)
prob.model.add_subsystem("f2fSystem", f2f_subsystem)
f2f_subsystem.register_to_model(prob.model, "f2fSystem")

# setup the optimizer settings # COBYLA for auto-FDing
optimizer = "pyoptsparse"
optimizer = "scipy"
if optimizer == "scipy":
prob.driver = om.ScipyOptimizeDriver(optimizer="SLSQP", tol=1.0e-9, disp=True)
elif optimizer == "pyoptsparse":
Expand Down
2 changes: 1 addition & 1 deletion funtofem/model/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def __init__(

@property
def full_name(self) -> str:
return f"{self._scenario_name}.{self.name}"
return f"{self._scenario_name}-{self.name}"

def zero_derivatives(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion funtofem/model/variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def full_name(self) -> str:
if self._scenario_name is None:
return self.name
else:
return f"{self._scenario_name}.{self.name}"
return f"{self._scenario_name}-{self.name}"

@classmethod
def structural(cls, name: str, value=0.0):
Expand Down

0 comments on commit 38003e8

Please sign in to comment.