Skip to content

Commit

Permalink
Revert "Modal idf (#360)"
Browse files Browse the repository at this point in the history
This reverts commit d212716.
  • Loading branch information
sean-engelstad authored Jan 22, 2025
1 parent d212716 commit 7dd2388
Show file tree
Hide file tree
Showing 18 changed files with 63 additions and 1,212 deletions.
11 changes: 1 addition & 10 deletions funtofem/driver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,6 @@
from .funtofem_nlbgs_driver import *
from .funtofem_nlbgs_fsi_subiters_driver import *
from .transfer_settings import *
import importlib
caps_loader = importlib.util.find_spec("pyCAPS")
if caps_loader is not None:
from .funtofem_shape_driver import *
from .funtofem_shape_driver import *
from .oneway_struct_driver import *
from .oneway_aero_driver import *

# modal IDF driver
from .modal_idf_driver import *

# import all the custom or special drivers
from .custom import *
24 changes: 7 additions & 17 deletions funtofem/driver/_funtofem_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,6 @@ def __init__(
whether to save and reload funtofem states
"""

# assert at least one coupled scenario
self.coupled_scenarios = []
if model is not None: # only case where model is None is fakeModel?
any_coupled = any([scenario.coupled for scenario in model.scenarios])
assert any_coupled

self.coupled_scenarios = [scenario for scenario in model.scenarios if scenario.coupled]

# add the comm manger
if comm_manager is not None:
comm_manager = comm_manager
Expand Down Expand Up @@ -175,8 +167,7 @@ def solve_forward(self, steps=None):
body.update_shape(complex_run)

# loop over the forward problem for the different scenarios
for scenario in self.coupled_scenarios:

for scenario in self.model.scenarios:
# tell the solvers what the variable values and functions are for this scenario
if not self.fakemodel:
self._distribute_variables(scenario, self.model.bodies)
Expand Down Expand Up @@ -232,10 +223,11 @@ def solve_adjoint(self):

# Zero the derivative values stored in the function
self._zero_derivatives()
for func in functions:
func.zero_derivatives()

# Set the functions into the solvers
for scenario in self.coupled_scenarios:

for scenario in self.model.scenarios:
# tell the solvers what the variable values and functions are for this scenario
self._distribute_variables(scenario, self.model.bodies)
self._distribute_functions(scenario, self.model.bodies)
Expand Down Expand Up @@ -296,11 +288,9 @@ def _initialize_adjoint(self, scenario, bodies):

def _zero_derivatives(self):
"""zero all model derivatives"""
# TODO : only zero derivatives in coupled scenarios when using
for scenario in self.coupled_scenarios: # no need to zero composite functions, they are exactly diff later with no += effects
for func in scenario.functions:
for var in self.model.get_variables():
func.derivatives[var] = 0.0
for func in self.model.get_functions(all=True):
for var in self.model.get_variables():
func.derivatives[var] = 0.0
return

def _post_forward(self, scenario, bodies):
Expand Down
4 changes: 0 additions & 4 deletions funtofem/driver/custom/__init__.py

This file was deleted.

42 changes: 0 additions & 42 deletions funtofem/driver/custom/multi_driver.py

This file was deleted.

209 changes: 0 additions & 209 deletions funtofem/driver/custom/oneway_struct_trim_driver.py

This file was deleted.

2 changes: 1 addition & 1 deletion funtofem/driver/funtofem_shape_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def __init__(
self._flow_solver_type = "fun3d"
# TBD on new types
else: # check with shape change
if fun3d_loader is not None and caps_loader is not None:
if fun3d_loader is not None:
if isinstance(model.flow, Fun3dModel):
self._flow_solver_type = "fun3d"
self.flow_aim = model.flow.fun3d_aim
Expand Down
Loading

0 comments on commit 7dd2388

Please sign in to comment.