Allen Cahn#
Input Class#
Input: Allen-Cahn#
- class phasefieldx.Element.Allen_Cahn.Input.Input(l=1.0, mobility=1.0, save_solution_xdmf=False, save_solution_vtu=True, result_folder_name='results')[source]#
Bases:
objectClass for managing phase-field simulation parameters.
This class encapsulates parameters related to phase-field fracture simulations and provides methods for setting and logging these parameters.
- Attributes:
Gc (float): Critical energy release rate. l (float): Length scale parameter. label (str): A label associated with the simulation. color (str): A color associated with the simulation.
- Methods:
__init__(): Initialize the SimulationPhaseFieldFracture class with default parameters. save_log_info(logger): Logs the simulation parameters using the provided logger. __str__(): Returns a string representation of the simulation parameters.
Methods
save_log_info(logger)Log the simulation parameters using the provided logger.
save_parameters_to_csv([filename])Save the simulation parameters to a CSV file for easy loading with pandas.
Solver (free energy)#
Solver: Free Energy (Allen-Cahn)#
Static
- phasefieldx.Element.Allen_Cahn.solver.solver_static.solve(Data, msh, final_time, V_Φ, bc_list_phi=[], update_boundary_conditions=None, update_loading=None, initial_condition=None, ds_bound=None, dt=1.0, path=None, quadrature_degree=2, case='DOUBLE', V_gradient_Φ=None)[source]#
Solver for the Free Energy (Allen-Cahn) equation.
- Parameters:
- Dataphasefieldx.Data
Data object containing simulation parameters.
- mshdolfinx.cpp.mesh.Mesh
Mesh object defining the computational domain.
- final_timefloat
Final pseudo time for the simulation.
- V_phidolfinx.fem.FunctionSpace
Function space for the phase-field variable phi.
- bc_list_philist of dolfinx.fem.DirichletBC, optional
List of Dirichlet boundary conditions for phi (default is []).
- update_boundary_conditionsfunction, optional
Function to update boundary conditions based on time (default is None).
- update_loadingfunction, optional
Function to update external loading conditions based on time (default is None).
- initial_conditiondolfinx.fem.Function, optional
Initial condition for phi (default is None).
- ds_boundnumpy.ndarray, optional
Array containing boundary descriptions for reaction forces (default is None).
- dtfloat, optional
Time step size (default is 1.0).
- pathstr, optional
Path to store simulation results (default is current working directory).
- Returns:
- None
Notes
This function initializes and solves the Allen-Cahn equation for the phase-field variable phi, which represents a free energy minimization problem. It uses a Newton-type solver to update phi over the specified time period. Simulation progress is logged, and results are saved using Paraview-compatible formats.
Examples
# Initialize Data, msh, V_phi, and optionally update functions solve(Data, msh, 10.0, V_phi, bc_list_phi, update_boundary_conditions, update_loading)
# This will simulate the free energy minimization problem using Allen-Cahn equation, # saving results in the specified directory.