-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.jl
More file actions
56 lines (48 loc) · 2.95 KB
/
Copy pathrun.jl
File metadata and controls
56 lines (48 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# ===========================================================================
# PhaseFieldFracture — a readable, pure-Julia phase-field fracture solver
#
# Author: Yang Bai — Materials Mechanics Laboratory (MMLab)
# Contact: yangbai90@outlook.com
# Copyright: © 2026 Materials Mechanics Laboratory (MMLab). All rights reserved.
# ===========================================================================
# ===========================================================================
# Driver: single-edge-notched tension test (SENT)
# ===========================================================================
#
# Run with: julia run.jl
#
# A square plate [-0.5,0.5]² with a horizontal pre-crack from the left edge to
# the centre is pulled apart by prescribing a vertical displacement on the top
# edge while the bottom edge is clamped. The crack grows to the right.
include("PhaseFieldFracture.jl")
using .PhaseFieldFracture
# ---------------------------------------------------------------------------
# Geometry and mesh (keep ny even so mesh nodes lie on the crack line y = 0)
# ---------------------------------------------------------------------------
mesh = rectangle_mesh(100, 100; x0 = -0.5, x1 = 0.5, y0 = -0.5, y1 = 0.5)
crack = crack_line_nodes(mesh; crack_y = 0.0, tip_x = 0.0)
# ---------------------------------------------------------------------------
# Material (E in MPa, lengths in mm, Gc in N/mm are a consistent unit set)
# ---------------------------------------------------------------------------
# `split` selects the tension/compression model of the elastic energy:
# :spectral Miehe's principal-strain split — only tension drives/degrades the
# crack (the physically correct default; see strainsplit.jl), or
# :none no split — the whole energy drives and is degraded (classic model;
# will also crack under compression, which is unphysical).
material = Material(E = 210_000.0, ν = 0.30, Gc = 2.7, ℓ = 0.04, k = 1e-8, split = :spectral)
# ---------------------------------------------------------------------------
# Solver settings
# ---------------------------------------------------------------------------
settings = Settings(nsteps = 50, umax = 8e-3, max_iter = 50, tol = 1e-6, out_every = 5)
# ---------------------------------------------------------------------------
# Assemble the problem and run
# ---------------------------------------------------------------------------
problem = Problem(mesh, material, settings, crack, "output", "HistoryOutput.txt")
println("Running the clean phase-field fracture example (", nnodes(mesh), " nodes)...")
@time u, φ, H = run_simulation(problem)
println()
println("Finished.")
println("History file: ", problem.histfile)
println("ParaView series: ", joinpath(problem.outdir, "timeseries.pvd"), " (open this in ParaView)")
println("Snapshots: ", joinpath(problem.outdir, "field_XXXX.vtu"))
println("Final max φ: ", maximum(φ))