jax_fem.solver module#

jax_fem.solver.ad_wrapper(problem, solver_options={}, adjoint_solver_options={})[source]#
jax_fem.solver.apply_bc(res_fn, problem, scale=1.0)[source]#
jax_fem.solver.apply_bc_vec(res_vec, dofs, problem, scale=1.0)[source]#
jax_fem.solver.arc_length_solver_disp_driven(problem, prev_u_vec, prev_lamda, prev_Delta_u_vec, prev_Delta_lamda, Delta_l=0.1, psi=1.0)[source]#

TODO: Does not support periodic B.C., need some work here.

jax_fem.solver.arc_length_solver_force_driven(problem, prev_u_vec, prev_lamda, prev_Delta_u_vec, prev_Delta_lamda, q_vec, Delta_l=0.1, psi=1.0)[source]#

TODO: Does not support periodic B.C., need some work here.

jax_fem.solver.assembleCSR(problem, dofs)[source]#
jax_fem.solver.assign_bc(dofs, problem)[source]#
jax_fem.solver.assign_ones_bc(dofs, problem)[source]#
jax_fem.solver.assign_zeros_bc(dofs, problem)[source]#
jax_fem.solver.calC(t, cmin, cmax)[source]#
jax_fem.solver.copy_bc(dofs, problem)[source]#
jax_fem.solver.dynamic_relax_solve(problem, tol=1e-06, nKMat=50, nPrint=500, info=True, info_force=True, initial_guess=None)[source]#

Implementation of

Luet, David Joseph. Bounding volume hierarchy and non-uniform rational B-splines for contact enforcement in large deformation finite element analysis of sheet metal forming. Diss. Princeton University, 2016. Chapter 4.3 Nonlinear System Solution

Particularly good for handling buckling behavior. There is a FEniCS version of this dynamic relaxation algorithm. The code below is a direct translation from the FEniCS version.

TODO: Does not support periodic B.C., need some work here.

jax_fem.solver.get_A(problem)[source]#
jax_fem.solver.get_flatten_fn(fn_sol_list, problem)[source]#
jax_fem.solver.get_q_vec(problem)[source]#

Used in the arc length method only, to get the external force vector q_vec

jax_fem.solver.implicit_vjp(problem, sol_list, params, v_list, adjoint_solver_options)[source]#
jax_fem.solver.jax_solve(A, b, x0, precond)[source]#

Solves the equilibrium equation using a JAX solver.

Parameters:

precond – Whether to calculate the preconditioner or not

TODO: This is useful for finite deformation plasticity.

jax_fem.solver.linear_incremental_solver(problem, res_vec, A, dofs, solver_options)[source]#

Linear solver at each Newton’s iteration

jax_fem.solver.linear_solver(A, b, x0, solver_options)[source]#
jax_fem.solver.operator_to_matrix(operator_fn, problem)[source]#

Only used for when debugging. Can be used to print the matrix, check the conditional number, etc.

jax_fem.solver.petsc_solve(A, b, ksp_type, pc_type)[source]#
jax_fem.solver.printInfo(error, t, c, tol, eps, qdot, qdotdot, nIters, nPrint, info, info_force)[source]#
jax_fem.solver.solver(problem, solver_options={})[source]#

Specify exactly either ‘jax_solver’ or ‘umfpack_solver’ or ‘petsc_solver’

Examples: (1) solver_options = {‘jax_solver’: {}} (2) solver_options = {‘umfpack_solver’: {}} (3) solver_options = {‘petsc_solver’: {‘ksp_type’: ‘bcgsl’, ‘pc_type’: ‘jacobi’}, ‘initial_guess’: some_guess}

Default parameters will be used if no instruction is found:

solver_options = {

# If multiple solvers are specified or no solver is specified, ‘jax_solver’ will be used. ‘jax_solver’: {

# The JAX built-in linear solver # Reference: https://jax.readthedocs.io/en/latest/_autosummary/jax.scipy.sparse.linalg.bicgstab.html ‘precond’: True,

}

‘umfpack_solver’: {

}

‘petsc_solver’: {

# PETSc solver # For more ksp_type and pc_type: https://www.mcs.anl.gov/petsc/petsc4py-current/docs/apiref/index.html ‘ksp_type’: ‘bcgsl’, # e.g., ‘minres’, ‘gmres’, ‘tfqmr’ ‘pc_type’: ‘ilu’, # e.g., ‘jacobi’

}

‘line_search_flag’: False, # Line search method ‘initial_guess’: initial_guess, # Same shape as sol_list ‘tol’: 1e-5, # Absolute tolerance for residual vector (l2 norm), used in Newton’s method ‘rel_tol’: 1e-8, # Relative tolerance for residual vector (l2 norm), used in Newton’s method

}

The solver imposes Dirichlet B.C. with “row elimination” method.

Some memo:

res(u) = D*r(u) + (I - D)u - u_b D = [[1 0 0 0]

[0 1 0 0] [0 0 0 0] [0 0 0 1]]

I = [[1 0 0 0]

[0 1 0 0] [0 0 1 0] [0 0 0 1]

A = d(res)/d(u) = D*dr/du + (I - D)

TODO: linear multipoint constraint

The function newton_update computes r(u) and dr/du

jax_fem.solver.umfpack_solve(A, b)[source]#