Skip to content

Commit

Permalink
Fix. (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhale authored Oct 24, 2024
1 parent 89dc592 commit 1127628
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions doc/demo/demo_plasticity_von_mises.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,11 @@
# \int\limits_{\partial\Omega_\text{inner}} \boldsymbol{n} \cdot \boldsymbol{v}
# \,\mathrm{d}\boldsymbol{x},
# $$
# where the vector $\boldsymbol{n}$ is a normal to the cylinder surface and the
# loading parameter $q$ is progressively increased from 0 to $q_\text{lim} =
# \frac{2}{\sqrt{3}}\sigma_0\log\left(\frac{R_o}{R_i}\right)$, the analytical
# collapse load for the perfect plasticity model without hardening.
# where the vector $\boldsymbol{n}$ is the outward normal to the cylinder
# surface and the loading parameter $q$ is progressively adjusted from 0 to
# $q_\text{lim} = \frac{2}{\sqrt{3}}\sigma_0\log\left(\frac{R_o}{R_i}\right)$,
# the analytical collapse load for the perfect plasticity model without
# hardening.
#
# The modelling is performed under assumptions of the plane strain and
# an associative plasticity law.
Expand Down Expand Up @@ -444,7 +445,7 @@ def sigma_external(derivatives):
# %%
u = fem.Function(V, name="displacement")
du = fem.Function(V, name="Newton_correction")
external_operator_problem = LinearProblem(J_replaced, -F_replaced, Du, bcs=bcs)
external_operator_problem = LinearProblem(J_replaced, F_replaced, Du, bcs=bcs)

# %%
# Defining a cell containing (Ri, 0) point, where we calculate a value of u
Expand Down Expand Up @@ -478,7 +479,7 @@ def sigma_external(derivatives):
external_operator_problem.solve(du)
du.x.scatter_forward()

Du.x.petsc_vec.axpy(1.0, du.x.petsc_vec)
Du.x.petsc_vec.axpy(-1.0, du.x.petsc_vec)
Du.x.scatter_forward()

evaluated_operands = evaluate_operands(F_external_operators)
Expand All @@ -500,7 +501,7 @@ def sigma_external(derivatives):
if MPI.COMM_WORLD.rank == 0:
print(f" it# {iteration} residual: {residual}")

u.x.petsc_vec.axpy(1.0, Du.x.petsc_vec)
u.x.petsc_vec.axpy(-1.0, Du.x.petsc_vec)
u.x.scatter_forward()

# Taking into account the history of loading
Expand Down

0 comments on commit 1127628

Please sign in to comment.