akantu_geomechanical_solver.akantu_geomechanical_solver module

Implementation of the Akantu Geomechanical simulator.

class akantu_geomechanical_solver.akantu_geomechanical_solver.AkantuGeomechanicalSolver(rock_model, flow_model, alpha: float, dump_iterations=False, update_stiffness=True)[source]

Bases: object

The class containing the geomechanical solver based on HeatTransferModel and SolidMechanicsModel of Akantu FEM library. Currently possible to have faults and fractures with the same hydro-mechanical properties only.

Args:

rock_model (SolidMechanicsModel or SolidMechanicsModelCohesive): Reference to the solid subproblem. flow_model (HeatTransferModel or HeatTransferModelCohesive): Reference to the flow subproblem. alpha (float): Biot coefficient. dump_iterations (bool): Boolean indicating dump of every newton iteration. update_stiffness (bool): Stiffness of the solid subproblem is updated while solving with Newton-Raphson. Otherwise, initial elastic stiffness is employed.

Attributes:

rock_model (aka.SolidMechanicsModel or aka.SolidMechanicsModelCohesive): Stores rock_model. flow_model (aka.HeatTransferModel or aka.HeatTransferInterfaceModel): Stores flow_model. alpha (float): Stores alpha. dump_iterations (bool): Stores dump_iterations. update_stiffness (bool): Stores update_stiffness. heat_interface_model (bool): A boolean indicating if the flow model is of type HeatTransferInterfaceModel. ghost_types (list): Stores possible ghost types. rock_dof_manager (aka.DOFManager): Reference to the DOFManager of rock_model flow_dof_manager (aka.DOFManager): Reference to the DOFManager of flow_model rhs_rock (aka.SolverVectorDefault or aka.SolverVectorDistributed): Reference to the solver vector containing residual for the rock_model rhs_flow (aka.SolverVectorDefault or aka.SolverVectorDistributed): Reference to the solver vector containing residual for the flow_model r2 (aka.SolverVectorDefault or aka.SolverVectorDistributed): Reference to the solver vector containing r2 vector of PCG x2k (aka.SolverVectorDefault or aka.SolverVectorDistributed): Reference to the solver vector containing x2k vector of PCG b1a (aka.SolverVectorDefault or aka.SolverVectorDistributed): Reference to the solver vector containing b1a vector of PCG A12x2 (aka.SolverVectorDefault or aka.SolverVectorDistributed): Reference to the solver vector containing the product [A12]{x2} x1k (aka.SolverVectorDefault or aka.SolverVectorDistributed): Reference to the solver vector containing x1k vector of PCG A21x1 (aka.SolverVectorDefault or aka.SolverVectorDistributed): Reference to the solver vector containing the product [A21]{x1} A22x2 (aka.SolverVectorDefault or aka.SolverVectorDistributed): Reference to the solver vector containing the product [A22]{x2} A11x1 (aka.SolverVectorDefault or aka.SolverVectorDistributed): Reference to the solver vector containing the product [A11]{x1} dx2 (aka.SolverVectorDefault or aka.SolverVectorDistributed): Reference to the solver vector containing dx2 vector of PCG z2 (aka.SolverVectorDefault or aka.SolverVectorDistributed): Reference to the solver vector containing z2 vector of PCG p2 (aka.SolverVectorDefault or aka.SolverVectorDistributed): Reference to the solver vector containing p2 vector of PCG p1 (aka.SolverVectorDefault or aka.SolverVectorDistributed): Reference to the solver vector containing p1 vector of PCG q (aka.SolverVectorDefault or aka.SolverVectorDistributed): Reference to the solver vector containing q vector of PCG

A11SolveLinear(rhs_solid, solution)[source]

Solution of the linear system A11x=b by the Akantu direct solver. Literally x = A11^{inv} b.

Args:

rhs_solid (ndarray or SolverVector): Right hand side of the equation. solution (ndarray or SolverVector): An array with solution of linear system.

A12Mult(p, A12x2, ignore_blocked_dofs)[source]

Wrapper over A12MultArray. If delta_p is a SolverVector, transforms it into an array and passes to A12MultArray. If A12x2 is a SolverVector, transforms the resulting array into the SolverVector.

Args:

p (ndarray[float] or SolverVector): An array with the pressure. A12x2 (ndarray or SolverVector): An array with the final product. ignore_blocked_dofs (bool): Turns off contribution of blocked pressure dofs to A12p product

A12MultArray(p_array, A12x2_array, ignore_blocked_dofs)[source]

Quadpoint-wise multiplication of Apd with pressure.

Args:

p_array (ndarray): An array with the pressure. A12x2 (ndarray): An array with the final product. ignore_blocked_dofs (bool): Turns off contribution of blocked pressure dofs to A12p product

A21Mult(du, A21x1, ignore_blocked_dofs)[source]

Wrapper over A21MultArray. If delta_p is a SolverVector, transforms it into an array and passes to A21MultArray. If A21x1 is a SolverVector, transforms the resulting array into the SolverVector.

Args:

delta_u (ndarray[float] or SolverVector): An array with displacement increment. A21x1 (ndarray or SolverVector): An array with the final product. ignore_blocked_dofs (bool): Turns off contribution of the blocked displacement dofs to A21du product

A21MultArray(du_array, A21x1_array, ignore_blocked_dofs)[source]

Quadpoint-wise multiplication of Adp with displacement increment.

Args:

du_array (ndarray): An array with displacement increment. A21x1_array (ndarray): An array with the final product. ignore_blocked_dofs (bool): Turns off contribution of blocked displacement dofs to the A21du product

A22Mult(p, A22x2)[source]

Explicit multiplication of A22 matrix with pressure vector.

Args:

p (ndarray or SolverVector): An array with pressures. A22x2 (ndarray or SolverVector): An array with final product.

A22SolveLinear(rhs_flow, solution)[source]

Solution of the linear system A22x=b by the Akantu direct solver. Literally x = A22^{inv} b.

Args:

rhs_flow (ndarray or SolverVector): Right hand side of the equation. solution (ndarray or SolverVector): An array with solution of the linear system.

assemble_gradu_global(grad_u_global, el_type, ghost_type)[source]

Assembles grad_u of each material into a global grad_u.

Args:

grad_u_global (ndarray): Global gradU array. el_type (aka.ElementType): Type of elements on which gradU is computed. ghost_type (aka.GhostType): Ghost type of elements.

computeNormalOpening(opening, normal)[source]

Dot product between opening vector and normals to cohesives.

Args:

opening (ndarray): An array with opening vectors. normal (ndarray): An array with normal vectors.

Returns:

normal_opening (ndarray): An array with normal openings.

compute_gradu_on_qpoints(u, el_type)[source]

Computes gradient of u, stores it in gradU internal field, and synchronizes it.

Args:

u (ndarray): Displacement field. el_type (aka.ElementType): Type of elements on which gradU is computed.

compute_residual_flow(du, residual_flow)[source]

Updates the residual to the flow subproblem according to the following equation: :math:’{f^p}_{n+1} - [C] {p}_{n+1} - [S] {dot{p}}_{n+1} - [A_{ extrm{dp}}] {dot{u}}_{n+1}’

Args:

du (ndarray[float]): An array with displacement increment. residual_flow (aka.SolverVector or ndarray): A global vector containing the residual for the flow subproblem.

compute_residual_rock(u_in, p_in, residual_rock)[source]

Updates the residual to the solid subproblem according to the following equation: :math:’{f^d}_{n+1} - [K]{d}_{n+1} + [A_{ extrm{pd}}] {p}_{n+1}’

Args:

u_in (ndarray[float]): An array with the displacement. p_in (ndarray[float]): An array with the pressure. residual_rock (aka.SolverVector or ndarra): A global vector containing the residual for the solid subproblem.

getNorm(model, array)[source]

Computes norm of a vector including blocked dofs but excluding ghosts.

Args:

model (SolidMechanicsModel or HeatTransferModel): Reference to the model. array (ndarray or SolverVector): An array whose norm the function is computing.

getNormWithoutBlockedDOFs(model, array)[source]

Computes norm of a vector ignoring blocked and ghost dofs.

Args:

model (SolidMechanicsModel or HeatTransferModel): Reference to the model. array (ndarray or SolverVector): An array whose norm the function is computing.

interpolate_pressure_on_qpoints(p_in)[source]

Interpolates pressure field p_in on quadrature points and stores it in the temperature_on_qpoints array.

Args:

p_in (ndarray): Nodal pressure field to be interpolated.

pcg_solve(x1_0, x2_0, b1, b2, it_options: IterativeOptions)[source]

Solves a linear two-fields problem by partitioned conjugate gradient methods (see Prevost 1997).

Args:

x1_0 (ndarray[float]): An array containing the first guess for the displacement increment. x2_0 (ndarray[float]): An array containing the first guess for the pressure increment. b1 (aka.SolverVector): A global vector containing the rhs for the solid subproblem. b2 (aka.SolverVector): A global vector containing the rhs for the flow subproblem. it_options (IterativeOptions): Contains iterative options to be used within NR and PCG

Returns:

x1 (ndarray[float]): An array containing the resulting displacement increment. x2 (ndarray[float]): An array containing the resulting pressure increment.

Raises:

Exception: PCG solver did not converge.

solve_step(delta_u_0, delta_p_0, it_options: IterativeOptions) bool[source]

Solves a single time step by the Newton Raphson solver.

Args:

delta_u_0 (ndarray[float]): An array containing the first guess for the displacement. delta_p_0 (ndarray[float]): An array containing the first guess for the pressure. it_options (IterativeOptions): Contains iterative options to be used within NR and PCG

Returns:

cvged (bool): True if a is the time step converged, False otherwise.

update_time_step_A22_solve(new_time_step: float)[source]

Updates the time step in the flow subpoblem. Necessary for the A_{22} operator in PCG.

Args:

new_time_step (float): Value of the new time step.

zeroAtBlockedDOFs(model, array)[source]

Set blocked DOFs to zero.

Args:

model (SolidMechanicsModel or HeatTransferModel): Reference to the model. array (ndarray or SolverVector): An array who is being modified.

zeroAtGhosts(model, array)[source]

Set ghost DOFs to zero.

Args:

model (SolidMechanicsModel or HeatTransferModel): Reference to the model. array (ndarray or SolverVector): An array who is being modified.

class akantu_geomechanical_solver.akantu_geomechanical_solver.IterativeOptions(pcg_maxiterations: int = 10, newton_maxiterations: int = 10, f_rtol: float = 0.0001, f_rock_tol: float = 1e-08, f_flow_tol: float = 1e-08, f0_rock_norm: float = 1.0, f0_flow_norm: float = 1.0)[source]

Bases: object

The class storing iterative parameters and keeping track of Newton and PCG iterations

Args:

pcg_maxiterations (int): Prescribes the maximum number of iterations for the partitioned conjugate gradient (PCG) solver. newton_maxiterations (int): The maximum number of iterations of the Newton-Raphson (NR) solver. f_rtol (float): Relative tolerance that will multiply the initial residuals both of the solid and flow subproblems. f_rock_tol (float): Absolute tolerance for the residual of the solid subproblem checked for NR convergence. f_flow_tol (float): Absolute tolerance for the residual of the flow subproblem checked both in NR and PCG solvers. f0_rock_norm (float): Initial norm of the residual for the solid subproblem. f0_flow_norm (float): Initial norm of the residual for the flow subproblem.

Attributes:

pcg_maxiterations (int): Stores pcg_maxiterations newton_maxiterations (int): Stores newton_maxiterations. f_rtol (float): Stores f_rtol. f_rock_tol (float): Stores f_rock_tol. f_flow_tol (float): Stores f_flow_tol. f0_rock_norm (float): Stores f0_rock_norm. f0_flow_norm (float): Stores f0_flow_norm. pcg_iteration (int): Stores current iteration number of the PCG solver. nr_iteration (int): Stores current iteration number of the NR solver.

check_newton_cvgence(res_rock: float, res_flow: float)[source]

Checks convergence of the NR solver by comparing residuals of the solid and fluid subproblems with absolute tolerances.

Args:

f_norm (float): Norm of the residual of the flow subproblem.

Returns:

check (bool): True if converged, False if not.

check_pcg_cvgence(f_norm: float)[source]

Checks convergence of the PCG solver by comparing the residual with maximum of two tolerances: relative-tolerance based and absolute one.

Args:

f_norm (float): Norm of the residual of the flow subproblem.

Returns:

check (bool): True if converged, False if not.

isless(a: float, b: float, abs_tol=1e-09)[source]

Compares two floats with user-provided absolute tolerance.

Args:

a (float): First float to compare. b (float): Second float to compare. abs_tol (float): User-provided absolute tolerance.

Returns:

check (bool): True if a is less or equal to b + tolerance, False otherwise.