Skip to content

Commit

Permalink
black reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-engelstad committed Oct 25, 2023
1 parent 73fb50b commit 03821f1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
18 changes: 14 additions & 4 deletions funtofem/driver/funtofem_nlbgs_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,13 @@ def _solve_steady_forward(self, scenario, steps=None):
forward_tol = solver.forward_tolerance
if forward_resid < forward_tol:
if self.comm.rank == 0:
print(f"F2F Steady Forward analysis of scenario {scenario.name} exited early")
print(f"\tat step {step} with tolerance {forward_resid} < {forward_tol}", flush=True)
print(
f"F2F Steady Forward analysis of scenario {scenario.name} exited early"
)
print(
f"\tat step {step} with tolerance {forward_resid} < {forward_tol}",
flush=True,
)
exit_early = True
break
if exit_early:
Expand Down Expand Up @@ -277,8 +282,13 @@ def _solve_steady_adjoint(self, scenario):
adjoint_tol = solver.adjoint_tolerance
if adjoint_resid < adjoint_tol:
if self.comm.rank == 0:
print(f"F2F Steady Adjoint analysis of scenario {scenario.name}")
print(f"\texited early at step {step} with tolerance {adjoint_resid} < {adjoint_tol}", flush=True)
print(
f"F2F Steady Adjoint analysis of scenario {scenario.name}"
)
print(
f"\texited early at step {step} with tolerance {adjoint_resid} < {adjoint_tol}",
flush=True,
)
exit_early = True
break
if exit_early:
Expand Down
2 changes: 1 addition & 1 deletion funtofem/interface/_solver_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ def step_post(self, scenario, bodies, step):
The step number. Will start at the final step and march backwards to 0, the initial condition.
"""
return 0

def get_forward_residual(self, step=0):
"""get the scalar total forward residual for this discipline interface"""
return 0.0
Expand Down
4 changes: 1 addition & 3 deletions funtofem/interface/fun3d_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,9 +629,7 @@ def post(self, scenario, bodies):
"""

# report warning if flow residual too large
resid = self.get_forward_residual(
step=scenario.steps
) # step=scenario.steps
resid = self.get_forward_residual(step=scenario.steps) # step=scenario.steps
self._forward_done = True
self._forward_resid = resid
if abs(resid.real) > 1.0e-10:
Expand Down
6 changes: 3 additions & 3 deletions funtofem/model/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,13 @@ def set_temperature(self, T_ref: float = 300.0, T_inf: float = 300.0):
self.T_ref = T_ref
self.T_inf = T_inf
return self
def set_stop_criterion(self, early_stopping:bool=True, min_steps=None):

def set_stop_criterion(self, early_stopping: bool = True, min_steps=None):
"""
turn on the early stopping criterion, note you probably don't need
to set the min steps (as it defaults to the # of uncoupled steps)
The stopping tolerances are set in each discipline interface
Parameters
----------
early_stopping: bool
Expand Down

0 comments on commit 03821f1

Please sign in to comment.