Skip to content

Commit

Permalink
Fixing remaining check_partials attributes in mphys wrappers (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
timryanb authored Jan 29, 2025
1 parent 3d31860 commit d10d50f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions tacs/mphys/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def buckling_setup(scenario_name, fea_assembler)
self.constraint_setup = constraint_setup
self.buckling_setup = buckling_setup
self.pytacs_options = pytacs_options
self.check_partials = check_partials
self.under_check_partials = check_partials
self.conduction = conduction
if isinstance(coupling_loads, str):
self.coupling_loads = [coupling_loads]
Expand Down Expand Up @@ -260,7 +260,7 @@ def get_coupling_group_subsystem(self, scenario_name=None):
return TacsCouplingGroup(
fea_assembler=self.fea_assembler,
discipline_vars=self.discipline_vars,
check_partials=self.check_partials,
check_partials=self.under_check_partials,
coupling_loads=self.coupling_loads,
scenario_name=scenario_name,
problem_setup=self.problem_setup,
Expand Down Expand Up @@ -323,7 +323,7 @@ def get_post_coupling_subsystem(self, scenario_name=None):
"""
return TacsPostcouplingGroup(
fea_assembler=self.fea_assembler,
check_partials=self.check_partials,
check_partials=self.under_check_partials,
discipline_vars=self.discipline_vars,
write_solution=self.write_solution,
scenario_name=scenario_name,
Expand Down
4 changes: 2 additions & 2 deletions tacs/mphys/coupling.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def initialize(self):

def setup(self):
self.fea_assembler = self.options["fea_assembler"]
self.check_partials = self.options["check_partials"]
self.under_check_partials = self.options["check_partials"]
self.coupling_loads = self.options["coupling_loads"]
self.coupled = len(self.coupling_loads) > 0
self.discipline_vars = self.options["discipline_vars"]
Expand Down Expand Up @@ -93,7 +93,7 @@ def setup(self):
"solver",
TacsSolver(
fea_assembler=self.fea_assembler,
check_partials=self.check_partials,
check_partials=self.under_check_partials,
coupling_loads=self.coupling_loads,
discipline_vars=self.discipline_vars,
res_ref=self.res_ref,
Expand Down
12 changes: 6 additions & 6 deletions tacs/mphys/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def initialize(self):
self.options.declare("write_solution")

self.fea_assembler = None
self.check_partials = False
self.under_check_partials = False

def setup(self):
self.fea_assembler = self.options["fea_assembler"]
self.check_partials = self.options["check_partials"]
self.under_check_partials = self.options["check_partials"]
self.auto_write_solution = self.options["write_solution"]
self.discipline_vars = self.options["discipline_vars"]
self.solution_counter = 0
Expand Down Expand Up @@ -104,7 +104,7 @@ def compute(self, inputs, outputs):

def compute_jacvec_product(self, inputs, d_inputs, d_outputs, mode):
if mode == "fwd":
if not self.check_partials:
if not self.under_check_partials:
raise ValueError("TACS forward mode requested but not implemented")
if mode == "rev":
# always update internal because same tacs object could be used by multiple scenarios
Expand Down Expand Up @@ -139,11 +139,11 @@ def initialize(self):
self.options.declare("check_partials")

self.fea_assembler = None
self.check_partials = False
self.under_check_partials = False

def setup(self):
self.fea_assembler = self.options["fea_assembler"]
self.check_partials = self.options["check_partials"]
self.under_check_partials = self.options["check_partials"]
self.discipline_vars = self.options["discipline_vars"]

self.coords_name = self.discipline_vars.COORDINATES
Expand Down Expand Up @@ -197,7 +197,7 @@ def compute(self, inputs, outputs):

def compute_jacvec_product(self, inputs, d_inputs, d_outputs, mode):
if mode == "fwd":
if not self.check_partials:
if not self.under_check_partials:
raise ValueError("TACS forward mode requested but not implemented")
if mode == "rev":
# always update internal because same tacs object could be used by multiple scenarios
Expand Down
8 changes: 4 additions & 4 deletions tacs/mphys/postcoupling.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def initialize(self):

def setup(self):
self.fea_assembler = self.options["fea_assembler"]
self.check_partials = self.options["check_partials"]
self.under_check_partials = self.options["check_partials"]
self.discipline_vars = self.options["discipline_vars"]
self.auto_write_solution = self.options["write_solution"]

Expand Down Expand Up @@ -58,7 +58,7 @@ def setup(self):
"eval_funcs",
TacsFunctions(
fea_assembler=self.fea_assembler,
check_partials=self.check_partials,
check_partials=self.under_check_partials,
discipline_vars=self.discipline_vars,
write_solution=self.auto_write_solution,
),
Expand All @@ -80,7 +80,7 @@ def setup(self):
"mass_funcs",
MassFunctions(
fea_assembler=self.fea_assembler,
check_partials=self.check_partials,
check_partials=self.under_check_partials,
discipline_vars=self.discipline_vars,
),
promotes_inputs=promotes_inputs,
Expand All @@ -105,7 +105,7 @@ def setup(self):
"buckling",
TacsBuckling(
fea_assembler=self.fea_assembler,
check_partials=self.check_partials,
check_partials=self.under_check_partials,
write_solution=self.write_solution,
),
promotes_inputs=promotes_inputs + promotes_states,
Expand Down

0 comments on commit d10d50f

Please sign in to comment.