Skip to content

Commit

Permalink
Merge pull request #91 from StatikTUM/fix/solution-info
Browse files Browse the repository at this point in the history
Fix solution info for arc-length
  • Loading branch information
oberbichler authored Apr 22, 2022
2 parents 8ebc2b7 + 51591a6 commit 4b13f1d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 3 additions & 4 deletions nfem/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ def perform_arc_length_control_step(self,
= False
) -> None:
"""Perform a solution step using arc-length control."""
solution = self.solve_arc_length_control(tolerance, max_iterations)
solution_info = self.solve_arc_length_control(tolerance, max_iterations)

if solve_det_k or solve_attendant_eigenvalue:
assembler = Assembler(self)
Expand All @@ -647,9 +647,8 @@ def perform_arc_length_control_step(self,
self.solve_eigenvalues(assembler=assembler)

if info:
print('Arc-Length-Control with length = ' +
f'{solution.constraint.squared_l_hat**0.5}')
solution.show()
print(solution_info.message)
solution_info.show()
print()

def solve_det_k(self) -> None:
Expand Down
7 changes: 6 additions & 1 deletion nfem/solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,10 @@ def compute_squared_arc_length(model):

model.status = ModelStatus.equilibrium

return SolutionInfo(True, rnorm_history, dnorm_history)
solution_info = SolutionInfo(True, rnorm_history, dnorm_history)
solution_info.message = f'Arc-Length-Control with length = {squared_l_hat**0.5}'

return solution_info


def _element_linear_r(element: Element):
Expand All @@ -474,6 +477,8 @@ def _element_k(element: Element):
class SolutionInfo:
"""Container for linear solution info."""

message: str

def __init__(self, converged: bool, rnorm: List[float], dnorm: List[float]):
"""Create a new linear SolutionInfo."""
self.converged = converged
Expand Down

0 comments on commit 4b13f1d

Please sign in to comment.