Repository navigation
Expand file tree
/
Copy pathPhaseFieldFracture.jl
More file actions
59 lines (53 loc) · 2.92 KB
/
Copy pathPhaseFieldFracture.jl
File metadata and controls
59 lines (53 loc) · 2.92 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
57
58
59
# ===========================================================================
# 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.
# ===========================================================================
# ===========================================================================
# PhaseFieldFracture — a small, readable 2D brittle phase-field solver
# ===========================================================================
#
# A self-contained rewrite that uses only the Julia standard library. Each
# file corresponds to one mathematical ingredient of the model:
#
# mesh.jl structured Q4 mesh of a rectangle
# element.jl Q4 shape functions, isoparametric map, quadrature
# strainsplit.jl Miehe tension/compression split of the elastic energy
# elasticity.jl plane-strain elasticity, degradation g(φ), tangent + Newton
# phasefield.jl AT2 damage system, history field H, irreversibility
# solver.jl staggered (alternate minimization) load stepping
# output.jl reaction / crack-tip post-processing, VTU + PVD + CSV output
#
# Model: small-strain, plane-strain, isotropic elasticity coupled to an AT2
# phase field, with a tension/compression split so that only tensile strain
# drives and is degraded by the crack. Energy functional
#
# E[u,φ] = ∫_Ω [ g(φ) ψ⁺(ε(u)) + ψ⁻(ε(u)) ] dΩ
# + Gc ∫_Ω ( φ²/2ℓ + ℓ/2 |∇φ|² ) dΩ ,
#
# g(φ) = (1-φ)² + k ,
# ψ⁺,ψ⁻ = tensile / compressive parts of ½ εᵀ D ε (Miehe spectral split),
#
# solved by alternate minimization with an irreversible history field
# H = maxₜ ψ⁺ driving the damage. The tensile stress is nonlinear in ε, so the
# displacement sub-problem is solved by Newton's method. Setting the material
# option `split = :none` recovers the classic no-split model ψ⁺ = ½ εᵀ D ε.
module PhaseFieldFracture
using LinearAlgebra
using SparseArrays
using Printf
include("mesh.jl") # Mesh, rectangle_mesh, crack_line_nodes, dof maps
include("element.jl") # GAUSS, shape, element, strain_matrix, cell_dofs
include("strainsplit.jl") # Miehe spectral tension/compression split (ψ⁺, σ±, C±)
include("elasticity.jl") # Material, constitutive, tangent+residual assembly, Newton
include("phasefield.jl") # AT2 assembly, history update, damage solve
include("solver.jl") # Settings, Problem, solve_dirichlet, run_simulation
include("output.jl") # reaction/crack post-processing, VTU + PVD + CSV I/O
export Mesh, rectangle_mesh, crack_line_nodes,
Material, Settings, Problem,
run_simulation, write_vtu, write_pvd,
reaction_top, crack_tip_x, max_free_phi,
nnodes, ncells
end # module