Skip to content

Commit

Permalink
correct add_grad_comp to set_grad_comp for struct, aero dvs
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-engelstad committed Nov 5, 2023
1 parent 87f9c69 commit a000693
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions funtofem/driver/funtofem_shape_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,8 +826,11 @@ def _get_struct_shape_derivatives(self, scenario):
for ifunc, func in enumerate(scenario.functions):
for ivar, var in enumerate(variables):
derivative = gradients[ifunc][ivar]
func.set_gradient_component(var, gradients[ifunc][ivar])

# only overwrite struct derivatives in remote driver case
if var.analysis_type == "structural" and self.is_remote:
func.set_gradient_component(var, gradients[ifunc][ivar])
elif var.analysis_type == "shape":
func.add_gradient_component(var, gradients[ifunc][ivar])
return

def _get_aero_shape_derivatives(self, scenario):
Expand Down Expand Up @@ -866,8 +869,8 @@ def _get_aero_shape_derivatives(self, scenario):
for ifunc, func in enumerate(scenario.functions):
for ivar, var in enumerate(variables):
derivative = gradients[ifunc][ivar]
func.set_gradient_component(var, derivative)

if var.analysis_type == "shape":
func.add_gradient_component(var, gradients[ifunc][ivar])
return

@property
Expand Down

0 comments on commit a000693

Please sign in to comment.