Phase-Field Fracture#
Input Class#
Input: Phase-Field Fracture#
- class phasefieldx.Element.Phase_Field_Fracture.Input.Input(E=210.0, nu=0.3, Gc=0.0027, l=0.015, rho=1.0, degradation='isotropic', split_energy='no', degradation_function='quadratic', irreversibility='no', fatigue=False, fatigue_degradation_function='asymptotic', fatigue_val=0.05625, k=0, save_solution_xdmf=False, save_solution_vtu=True, results_folder_name='results')[source]#
Bases:
objectClass for managing phase-field fracture simulation parameters.
This class encapsulates parameters related to phase-field fracture simulations and provides methods for setting, logging, and exporting these parameters.
- Attributes:
- Efloat
Young’s modulus of the material.
- nufloat
Poisson’s ratio of the material.
- Gcfloat
Critical energy release rate.
- lfloat
Length scale parameter.
- lambda_float
Lame’s first parameter calculated from E and nu.
- mufloat
Shear modulus calculated from E and nu.
- rhofloat
Density of the material.
- degradationstr
Type of material degradation (isotropic or anisotropic).
- split_energystr
Type of energy splitting (spectral, deviatoric, or none).
- degradation_functionstr
Type of degradation function (e.g., quadratic).
- irreversibilitystr
Indication of irreversibility of damage.
- fatiguebool
Indicates if fatigue degradation is enabled.
- fatigue_degradation_functionstr
Fatigue degradation function type.
- fatigue_valfloat
Fatigue degradation value.
- kint
A numerical parameter.
- save_solution_xdmfbool
Indicates whether to save solutions in XDMF format.
- save_solution_vtubool
Indicates whether to save solutions in VTU format.
- results_folder_namestr
Name of the folder to save simulation results.
Methods
__init__(…)
Initialize the Input class with default parameters.
save_log_info(logger)
Log the simulation parameters using the provided logger.
save_parameters_to_csv(filename=”parameters.input”)
Save the simulation parameters to a two-column text file (tab-separated) for easy loading with pandas.
__str__()
Return a string representation of the simulation parameters.
\(g(\phi)\) Degradation functions#
Degradation Functions \(g(\phi)\)#
This module provides various degradation functions and their derivatives, which are used in phase field fracture models.
Examples#
Plot the available degradation functions for illustrative purposes.
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> from phasefieldx.Element.Phase_Field_Fracture.g_degradation_functions import g, dg
Define the range for the phase field variable phi.
>>> phi = np.linspace(0.0, 1.0, 100)
Evaluate the degradation functions and their derivatives.
>>> g_quadratic = [g(p, "quadratic") for p in phi]
>>> g_cubic = [g(p, "cubic") for p in phi]
>>> g_quartic = [g(p, "quartic") for p in phi]
>>> dg_quadratic = [dg(p, "quadratic") for p in phi]
>>> dg_cubic = [dg(p, "cubic") for p in phi]
>>> dg_quartic = [dg(p, "quartic") for p in phi]
Plot the evaluated functions and their derivatives.
>>> fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5))
>>> _ = ax1.plot(phi, g_quadratic, label="Quadratic")
>>> _ = ax1.plot(phi, g_cubic, label="Cubic")
>>> _ = ax1.plot(phi, g_quartic, label="Quartic")
>>> ax1.set_xlabel(r"$\phi$")
>>> ax1.set_ylabel(r"$g(\phi)$")
>>> ax1.set_title("Phase Field Degradation Functions")
>>> ax1.legend()
>>> ax1.grid(True)
>>> _ = ax2.plot(phi, dg_quadratic, label="Quadratic")
>>> _ = ax2.plot(phi, dg_cubic, label="Cubic")
>>> _ = ax2.plot(phi, dg_quartic, label="Quartic")
>>> ax2.set_xlabel(r"$\phi$")
>>> ax2.set_ylabel(r"$g'(\phi)$")
>>> ax2.set_title("Derivatives of Degradation Functions")
>>> ax2.legend()
>>> ax2.grid(True)
>>> plt.tight_layout()
>>> plt.show()
- phasefieldx.Element.Phase_Field_Fracture.g_degradation_functions.alessi_degradation_derivative(phi)[source]#
Evaluate the derivative of the Alessi degradation function.
- Parameters:
- phifloat
The phase field variable.
- Returns:
- float
The value of the derivative of the Alessi degradation function.
- phasefieldx.Element.Phase_Field_Fracture.g_degradation_functions.alessi_degradation_function(phi)[source]#
Evaluate the Alessi degradation function.
- Parameters:
- phifloat
The phase field variable.
- Returns:
- float
The value of the Alessi degradation function.
- phasefieldx.Element.Phase_Field_Fracture.g_degradation_functions.cubic_degradation_derivative(phi)[source]#
Evaluate the derivative of the cubic degradation function.
- Parameters:
- phifloat
The phase field variable.
- Returns:
- float
The value of the derivative of the cubic degradation function.
- phasefieldx.Element.Phase_Field_Fracture.g_degradation_functions.cubic_degradation_function(phi)[source]#
Evaluate the cubic (Borden) degradation function.
- Parameters:
- phifloat
The phase field variable.
- Returns:
- float
The value of the cubic degradation function.
- phasefieldx.Element.Phase_Field_Fracture.g_degradation_functions.dg(phi, degradation_type)[source]#
Evaluate the derivative of the degradation function for a given phi and degradation type.
- Parameters:
- phifloat
The phase field variable.
- degradation_typestr
The type of degradation function (‘quadratic’, ‘cubic’, ‘quartic’, ‘alessi’, or ‘sargado’).
- Returns:
- float
The value of the derivative of the degradation function.
Examples
>>> import numpy as np >>> import matplotlib.pyplot as plt >>> from phasefieldx.Element.Phase_Field_Fracture.g_degradation_functions import dg >>> phi = np.linspace(0.0, 1.0, 100) >>> dg_quadratic = [dg(p, "quadratic") for p in phi] >>> dg_cubic = [dg(p, "cubic") for p in phi] >>> dg_quartic = [dg(p, "quartic") for p in phi] >>> plt.figure(figsize=(6, 5)) >>> plt.plot(phi, dg_quadratic, label="Quadratic") >>> plt.plot(phi, dg_cubic, label="Cubic") >>> plt.plot(phi, dg_quartic, label="Quartic") >>> plt.xlabel(r"$\phi$") >>> plt.ylabel(r"$g'(\phi)$") >>> plt.title("Derivatives of Degradation Functions") >>> plt.legend() >>> plt.grid(True) >>> plt.tight_layout() >>> plt.show()
- phasefieldx.Element.Phase_Field_Fracture.g_degradation_functions.g(phi, degradation_type)[source]#
Evaluate the degradation function for a given phi and degradation type.
- Parameters:
- phifloat
The phase field variable.
- degradation_typestr
The type of degradation function (‘quadratic’, ‘cubic’, ‘quartic’, ‘alessi’, or ‘sargado’).
- Returns:
- float
The value of the degradation function.
Examples
>>> import numpy as np >>> import matplotlib.pyplot as plt >>> from phasefieldx.Element.Phase_Field_Fracture.g_degradation_functions import g >>> phi = np.linspace(0.0, 1.0, 100) >>> g_quadratic = [g(p, "quadratic") for p in phi] >>> g_cubic = [g(p, "cubic") for p in phi] >>> g_quartic = [g(p, "quartic") for p in phi] >>> plt.figure(figsize=(6, 5)) >>> plt.plot(phi, g_quadratic, label="Quadratic") >>> plt.plot(phi, g_cubic, label="Cubic") >>> plt.plot(phi, g_quartic, label="Quartic") >>> plt.xlabel(r"$\phi$") >>> plt.ylabel(r"$g(\phi)$") >>> plt.title("Phase Field Degradation Functions") >>> plt.legend() >>> plt.grid(True) >>> plt.tight_layout() >>> plt.show()
- phasefieldx.Element.Phase_Field_Fracture.g_degradation_functions.quadratic_degradation_derivative(phi)[source]#
Evaluate the derivative of the quadratic degradation function.
- Parameters:
- phifloat
The phase field variable.
- Returns:
- float
The value of the derivative of the quadratic degradation function.
- phasefieldx.Element.Phase_Field_Fracture.g_degradation_functions.quadratic_degradation_function(phi)[source]#
Evaluate the quadratic degradation function.
- Parameters:
- phifloat
The phase field variable.
- Returns:
- float
The value of the quadratic degradation function.
- phasefieldx.Element.Phase_Field_Fracture.g_degradation_functions.quartic_degradation_derivative(phi)[source]#
Evaluate the derivative of the quartic degradation function.
- Parameters:
- phifloat
The phase field variable.
- Returns:
- float
The value of the derivative of the quartic degradation function.
- phasefieldx.Element.Phase_Field_Fracture.g_degradation_functions.quartic_degradation_function(phi)[source]#
Evaluate the quartic degradation function.
- Parameters:
- phifloat
The phase field variable.
- Returns:
- float
The value of the quartic degradation function.
- phasefieldx.Element.Phase_Field_Fracture.g_degradation_functions.sargado_degradation_derivative(phi)[source]#
Evaluate the derivative of the Sargado degradation function.
- Parameters:
- phifloat
The phase field variable.
- Returns:
- float
The value of the derivative of the Sargado degradation function.
- phasefieldx.Element.Phase_Field_Fracture.g_degradation_functions.sargado_degradation_function(phi)[source]#
Evaluate the Sargado degradation function.
- Parameters:
- phifloat
The phase field variable.
- Returns:
- float
The value of the Sargado degradation function.
Energy Split#
Energy Decomposition#
Regarding energy degradation, there are two main descriptions of the constitutive free energy functional. The isotropic model degrades all the energy; in the other case, the anisotropic model only degrades the energy related to tension efforts, trying to account that cracks only are generated under tension efforts.
In the Isotropic constitutive free energy functional,
the degradation function \(g(\phi)\) degrades all the energy \(\psi(\boldsymbol \epsilon(\boldsymbol u))\). In the case of the anisotropic constitutive free energy functional,
the energy \(\psi(\boldsymbol \epsilon(\boldsymbol u))\) is split in two components, \(\psi=\psi_a+\psi_b\), in which the component \(\psi_a\) attains to the energy relative to tensions, so the degradation function only applied to it, avoiding the creation of crack due to compression effort.
There are several methods to carry out the energy slip. PhaseFieldX code implements the Spectral [Miehe] and volumetric-deviatoric [Amor] decomposition.
- phasefieldx.Element.Phase_Field_Fracture.split_energy_stress_tangent_functions.psi_a(u, DataSimulation)[source]#
Evaluate the positive part of the strain energy density function based on the specified degradation type.
- Parameters:
- uufl.Function
The displacement field.
- DataSimulationobject
An object containing simulation parameters, including degradation type and split energy type.
- Returns:
- float
The positive part of the strain energy density.
- phasefieldx.Element.Phase_Field_Fracture.split_energy_stress_tangent_functions.psi_a_deviatoric(u, lambda_, mu)[source]#
Evaluate the deviatoric positive part of the strain energy density function.
- Parameters:
- uufl.Function
The displacement field.
- lambda_float
The first Lamé parameter.
- mufloat
The second Lamé parameter.
- Returns:
- float
The deviatoric positive part of the strain energy density.
- phasefieldx.Element.Phase_Field_Fracture.split_energy_stress_tangent_functions.psi_a_spectral(u, lambda_, mu)[source]#
Evaluate the spectral positive part of the strain energy density function.
- Parameters:
- uufl.Function
The displacement field.
- lambda_float
The first Lamé parameter.
- mufloat
The second Lamé parameter.
- Returns:
- float
The spectral positive part of the strain energy density.
- phasefieldx.Element.Phase_Field_Fracture.split_energy_stress_tangent_functions.psi_b(u, DataSimulation)[source]#
Evaluate the negative part of the strain energy density function based on the specified degradation type.
- Parameters:
- uufl.Function
The displacement field.
- DataSimulationobject
An object containing simulation parameters, including degradation type and split energy type.
- Returns:
- float
The negative part of the strain energy density.
- phasefieldx.Element.Phase_Field_Fracture.split_energy_stress_tangent_functions.psi_b_deviatoric(u, lambda_, mu)[source]#
Evaluate the deviatoric negative part of the strain energy density function.
- Parameters:
- uufl.Function
The displacement field.
- lambda_float
The first Lamé parameter.
- mufloat
The second Lamé parameter.
- Returns:
- float
The deviatoric negative part of the strain energy density.
- phasefieldx.Element.Phase_Field_Fracture.split_energy_stress_tangent_functions.psi_b_spectral(u, lambda_, mu)[source]#
Evaluate the spectral negative part of the strain energy density function.
- Parameters:
- uufl.Function
The displacement field.
- lambda_float
The first Lamé parameter.
- mufloat
The second Lamé parameter.
- Returns:
- float
The spectral negative part of the strain energy density.
- phasefieldx.Element.Phase_Field_Fracture.split_energy_stress_tangent_functions.sigma_a(u, DataSimulation)[source]#
Evaluate the positive part of the stress tensor based on the specified degradation type.
- Parameters:
- uufl.Function
The displacement field.
- DataSimulationobject
An object containing simulation parameters, including degradation type and split energy type.
- Returns:
- ufl.Expr
The positive part of the stress tensor.
- phasefieldx.Element.Phase_Field_Fracture.split_energy_stress_tangent_functions.sigma_a_deviatoric(u, lambda_, mu)[source]#
Evaluate the deviatoric positive part of the stress tensor.
- Parameters:
- uufl.Function
The displacement field.
- lambda_float
The first Lamé parameter.
- mufloat
The second Lamé parameter.
- Returns:
- ufl.Expr
The deviatoric positive part of the stress tensor.
- phasefieldx.Element.Phase_Field_Fracture.split_energy_stress_tangent_functions.sigma_a_spectral(u, lambda_, mu)[source]#
Evaluate the spectral positive part of the stress tensor.
- Parameters:
- uufl.Function
The displacement field.
- lambda_float
The first Lamé parameter.
- mufloat
The second Lamé parameter.
- Returns:
- ufl.Expr
The spectral positive part of the stress tensor.
- phasefieldx.Element.Phase_Field_Fracture.split_energy_stress_tangent_functions.sigma_b(u, DataSimulation)[source]#
Evaluate the negative part of the stress tensor based on the specified degradation type.
- Parameters:
- uufl.Function
The displacement field.
- DataSimulationobject
An object containing simulation parameters, including degradation type and split energy type.
- Returns:
- ufl.Expr
The negative part of the stress tensor.
- phasefieldx.Element.Phase_Field_Fracture.split_energy_stress_tangent_functions.sigma_b_deviatoric(u, lambda_, mu)[source]#
Evaluate the deviatoric negative part of the stress tensor.
- Parameters:
- uufl.Function
The displacement field.
- lambda_float
The first Lamé parameter.
- mufloat
The second Lamé parameter.
- Returns:
- ufl.Expr
The deviatoric negative part of the stress tensor.
- phasefieldx.Element.Phase_Field_Fracture.split_energy_stress_tangent_functions.sigma_b_spectral(u, lambda_, mu)[source]#
Evaluate the spectral negative part of the stress tensor.
- Parameters:
- uufl.Function
The displacement field.
- lambda_float
The first Lamé parameter.
- mufloat
The second Lamé parameter.
- Returns:
- ufl.Expr
The spectral negative part of the stress tensor.
\(f(\bar{\alpha})\) Fatigue Degradation functions#
Fatigue Degradation Functions \(f(\bar{\alpha})\)#
This module provides functions to evaluate fatigue degradation. Fatigue degradation functions describe how the degradation evolves over time or under repeated loading conditions. The degradation is typically quantified using a parameter \(\bar{\alpha}\), which represents the accumulated variable.
- phasefieldx.Element.Phase_Field_Fracture.fatigue_degradation_functions.asymptotic(alpha_bar, Data)[source]#
Calculate the asymptotic fatigue degradation function.
- Parameters:
- alpha_barnumpy.ndarray
The array of alpha_bar values, representing some measure of material degradation.
- Dataobject
An object containing the fatigue degradation properties, specifically fatigue_val.
- Returns:
- numpy.ndarray
An array containing the calculated degradation values based on the asymptotic function.
- phasefieldx.Element.Phase_Field_Fracture.fatigue_degradation_functions.fatigue_degradation(alpha_bar, Data)[source]#
Select and evaluate the appropriate fatigue degradation function.
- Parameters:
- alpha_barnumpy.ndarray
The array of alpha_bar values, representing some measure of material degradation.
- Dataobject
An object containing the fatigue degradation properties, including the type of degradation function.
- Returns:
- numpy.ndarray
An array containing the calculated degradation values based on the selected degradation function.
- Raises:
- ValueError
If an invalid degradation type is provided in Data.fatigue_degradation_function.
Solvers#
Solver: Phase-field fracture/fatigue#
This module provides a solver for phase-field fracture and fatigue simulations using the Finite Element Method (FEM).
- phasefieldx.Element.Phase_Field_Fracture.solver.solver.solve(Data, msh, final_time, V_u, V_Φ, bc_list_u=[], bc_list_phi=[], update_boundary_conditions=None, f_list_u=None, T_list_u=None, update_loading=None, ds_bound=None, dt=1.0, path=None, bcs_list_u_names=None, min_stagger_iter=2, max_stagger_iter=10000, stagger_error_tol=1e-08)[source]#
Solve the phase-field fracture and fatigue problem.
- Parameters:
- Dataobject
An object containing the simulation parameters and settings.
- mshdolfinx.mesh
The computational mesh for the simulation.
- final_timefloat
The final simulation time.
- V_udolfinx.FunctionSpace
The function space for the displacement field.
- V_Φdolfinx.FunctionSpace
The function space for the phase-field.
- bc_list_ulist of dolfinx.DirichletBC, optional
List of Dirichlet boundary conditions for the displacement field.
- bc_list_philist of dolfinx.DirichletBC, optional
List of Dirichlet boundary conditions for the phase-field.
- update_boundary_conditionscallable, optional
A function to update boundary conditions dynamically.
- f_list_ulist, optional
List of body forces.
- T_list_ulist of tuple, optional
List of tuples containing traction forces and corresponding measures.
- update_loadingcallable, optional
A function to update loading conditions dynamically.
- ds_boundnumpy.ndarray, optional
Array of boundary measures for calculating reaction forces.
- dtfloat, optional
Time step size.
- pathstr, optional
Directory path for saving simulation results. Defaults to current working directory.
- min_stagger_iter: int
Minimum stagger iterations for numerical simulations.
- max_stagger_iter: int
Maximum stagger iterations for numerical simulations.
- stagger_error_tol: float
Tolerance for stagger error in simulations.
- Returns:
- None
Energy-controlled PFF solver: Variational scheme#
This module implements the variational solver for the phase-field fracture problem presented in Castillón et al.[1].
- phasefieldx.Element.Phase_Field_Fracture.solver.solver_ener_variational.solve(Data, msh, final_gamma, V_u, V_Φ, bc_list_u=[], bc_list_phi=[], f_list_u=None, T_list_u=None, ds_bound=None, dtau=0.0005, dtau_min=1e-12, dtau_max=0.1, path=None, bcs_list_u_names=None, c1=1.0, c2=1.0, threshold_gamma_save=None)[source]#
Solve the phase-field fracture problem.
- Parameters:
- Dataobject
Container for simulation parameters (material constants, Gc, l, degradation_function, save flags, results folder name, logging helpers, and methods like save_log_info).
- mshdolfinx.mesh.Mesh
The computational mesh.
- final_gammafloat
Target crack surface measure at which the simulation stops.
- V_udolfinx.FunctionSpace
Function space for the displacement field.
- V_Φdolfinx.FunctionSpace
Function space for the phase-field.
- bc_list_ulist, optional
List of dolfinx DirichletBC objects for the displacement DOFs (default: []).
- bc_list_philist, optional
List of dolfinx DirichletBC objects for the phase-field DOFs (default: []).
- f_list_ulist or None, optional
List of body forces (not required by this solver; default: None).
- T_list_ulist of tuple or None, optional
List of traction definitions as tuples (traction_vector, measure). The solver currently uses T_list_u[0] for external work and Lagrange coupling (default: None).
- ds_boundarray-like or None, optional
Boundary measure(s) for reaction force calculation (default: None).
- dtaufloat, optional
Initial pseudo-time increment / load parameter increment (default: 5e-4).
- dtau_minfloat, optional
Minimum allowed dtau before aborting (default: 1e-12).
- dtau_maxfloat, optional
Maximum allowed dtau (default: 0.1).
- pathstr or None, optional
Path where results folder will be created; if None uses current working dir (default: None).
- bcs_list_u_nameslist of str or None, optional
Names used when saving reaction files for displacement boundary conditions (default: None).
- c1float, optional
Coefficient multiplying the crack measure (default: 1.0).
- c2float, optional
Coefficient multiplying the external energy (default: 1.0).
- threshold_gamma_savefloat or None, optional
Threshold on change in gamma to trigger Paraview output. If None, treated as 0.0 (default: None).
Notes
The docstring parameters correspond to the function signature. Some inputs (like T_list_u) are accessed by index in the implementation and must be provided in that form.
Energy-controlled PFF solver: Non-variational scheme#
This module implements the non-variational solver for the phase-field fracture problem presented in Castillón et al.[1].
- phasefieldx.Element.Phase_Field_Fracture.solver.solver_ener_non_variational.solve(Data, msh, final_gamma, V_u, V_Φ, bc_list_u=[], bc_list_phi=[], f_list_u=None, T_list_u=None, ds_bound=None, dtau=0.0005, dtau_min=1e-12, dtau_max=0.1, path=None, bcs_list_u_names=None, c1=1.0, c2=1.0, threshold_gamma_save=None, case='AT2', rho=0.0)[source]#
Solve the phase-field fracture problem.
- Parameters:
- Dataobject
Container for simulation parameters (material constants, Gc, l, degradation_function, save flags, results folder name, logging helpers, and methods like save_log_info).
- mshdolfinx.mesh.Mesh
The computational mesh.
- final_gammafloat
Target crack surface measure at which the simulation stops.
- V_udolfinx.FunctionSpace
Function space for the displacement field.
- V_Φdolfinx.FunctionSpace
Function space for the phase-field.
- bc_list_ulist, optional
List of dolfinx DirichletBC objects for the displacement DOFs (default: []).
- bc_list_philist, optional
List of dolfinx DirichletBC objects for the phase-field DOFs (default: []).
- f_list_ulist or None, optional
List of body forces (not required by this solver; default: None).
- T_list_ulist of tuple or None, optional
List of traction definitions as tuples (traction_vector, measure). The solver currently uses T_list_u[0] for external work and Lagrange coupling (default: None).
- ds_boundarray-like or None, optional
Boundary measure(s) for reaction force calculation (default: None).
- dtaufloat, optional
Initial pseudo-time increment / load parameter increment (default: 5e-4).
- dtau_minfloat, optional
Minimum allowed dtau before aborting (default: 1e-12).
- dtau_maxfloat, optional
Maximum allowed dtau (default: 0.1).
- pathstr or None, optional
Path where results folder will be created; if None uses current working dir (default: None).
- bcs_list_u_nameslist of str or None, optional
Names used when saving reaction files for displacement boundary conditions (default: None).
- c1float, optional
Coefficient multiplying the crack measure (default: 1.0).
- c2float, optional
Coefficient multiplying the external energy (default: 1.0).
- threshold_gamma_savefloat or None, optional
Threshold on change in gamma to trigger Paraview output. If None, treated as 0.0 (default: None).
Notes
The docstring parameters correspond to the function signature. Some inputs (like T_list_u) are accessed by index in the implementation and must be provided in that form.