Skip to content

Commit

Permalink
Added checkMesh and printRes to primals.
Browse files Browse the repository at this point in the history
  • Loading branch information
friedenhe committed Dec 19, 2024
1 parent 6d36c67 commit b6463c6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion dafoam/mphys/mphys_dafoam.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,9 +756,20 @@ def solve_nonlinear(self, inputs, outputs):
DASolver.setThermal(q_conduct)
else:
raise AnalysisError("discipline not valid!")

# before running the primal, we need to check if the mesh
# quality is good
meshOK = DASolver.solver.checkMesh()

# solve the flow with the current design variable
DASolver()
# if the mesh is not OK, do not run the primal
if meshOK:
DASolver()
else:
DASolver.primalFail = 1

# after solving the primal, we need to print its residual info
DASolver.solver.calcPrimalResidualStatistics("print".encode())

# get the objective functions
funcs = {}
Expand Down

0 comments on commit b6463c6

Please sign in to comment.