optimism package
Subpackages
- optimism.contact package
- Subpackages
- optimism.contact.test package
- Submodules
- optimism.contact.test.SlidePlot module
- optimism.contact.test.test_Contact module
- optimism.contact.test.test_Cpp module
- optimism.contact.test.test_EdgeIntersection module
- optimism.contact.test.test_IntegralPenaltyContact module
- optimism.contact.test.test_LevelsetConstraint module
- optimism.contact.test.test_MortarGeom module
- optimism.contact.test.test_NeighborSearch module
- optimism.contact.test.test_NewtonGlobalization module
- optimism.contact.test.test_Search module
- optimism.contact.test.test_TwoBodyContact module
- optimism.contact.test.test_TwoBodyMortarContact module
- Module contents
- optimism.contact.test package
- Submodules
- optimism.contact.Contact module
compute_closest_distance_to_each_side()
compute_closest_distance_to_each_side_smooth()
compute_closest_edges_and_field_weights()
compute_friction_potential()
compute_projection_dists()
compute_projection_dists_smooth()
compute_q_coordinates()
compute_q_coordinates_from_field_weights()
get_closest_distance()
get_closest_distance_smooth()
get_closest_two_edges()
get_potential_interaction_list()
get_side_coordinates()
min_dist_squared()
- optimism.contact.EdgeCpp module
- optimism.contact.EdgeIntersection module
- optimism.contact.Friction module
- optimism.contact.IntegralPenaltyContact module
- optimism.contact.Levelset module
- optimism.contact.LevelsetConstraint module
- optimism.contact.MortarContact module
_neighbor_search()
assemble_area_weighted_gaps()
assemble_nodal_areas()
assembly_mortar_integral()
compute_average_normal()
compute_intersection()
compute_normal()
compute_normal_from_a()
edges_are_adjacent_non_pacman()
eval_linear_field_on_edge()
get_closest_neighbors()
get_closest_neighbors_for_self_contact()
get_facet_connectivities()
integrate_with_active_mortar()
integrate_with_mortar()
minimum_squared_distance()
normals_are_facing()
smooth_linear()
- optimism.contact.PenaltyContact module
- optimism.contact.Search module
- Module contents
- Subpackages
- optimism.material package
- Subpackages
- optimism.material.test package
- Submodules
- optimism.material.test.plotJ2Plastic module
- optimism.material.test.test_Gent module
- optimism.material.test.test_Hardening module
- optimism.material.test.test_HyperVisco module
- optimism.material.test.test_J2Plastic module
- optimism.material.test.test_LinearElastic module
- optimism.material.test.test_MaterialUniaxialSimulator module
- optimism.material.test.test_MultiBranchHyperVisco module
- optimism.material.test.test_RateSensitivity module
- Module contents
- optimism.material.test package
- Submodules
- optimism.material.Gent module
- optimism.material.Hardening module
- optimism.material.HyperViscoelastic module
- optimism.material.J2Plastic module
_compute_dissipation()
_energy_density()
compute_elastic_linear_strain()
compute_elastic_logarithmic_strain()
compute_elastic_seth_hill_strain()
compute_flow_direction()
compute_state_increment()
compute_state_new_finite_deformations()
compute_state_new_seth_hill()
compute_state_new_small_deformations()
create_material_model_functions()
elastic_deviatoric_free_energy()
elastic_free_energy()
elastic_volumetric_free_energy()
incremental_potential()
make_initial_state_finite_deformations()
make_initial_state_small_deformations()
make_properties()
r()
update_state()
- optimism.material.LinearElastic module
- optimism.material.MaterialModel module
- optimism.material.MaterialUniaxialSimulator module
UniaxialOutput
UniaxialOutput.time
UniaxialOutput.strainHistory
UniaxialOutput.stressHistory
UniaxialOutput.energyHistory
UniaxialOutput.internalVariableHistory
UniaxialOutput._asdict()
UniaxialOutput._field_defaults
UniaxialOutput._fields
UniaxialOutput._make()
UniaxialOutput._replace()
UniaxialOutput.energyHistory
UniaxialOutput.internalVariableHistory
UniaxialOutput.strainHistory
UniaxialOutput.stressHistory
UniaxialOutput.time
makeStrainTensor_()
run()
- optimism.material.MultiBranchHyperViscoelastic module
_compute_dissipated_energy()
_compute_elastic_logarithmic_strain()
_compute_state_increment()
_compute_state_new()
_dissipation_potential()
_energy_density()
_eq_strain_energy()
_make_properties()
_neq_strain_energy()
_return_Gneq_id_for_branch()
_return_state_for_branch()
create_material_model_functions()
- optimism.material.Neohookean module
- Module contents
- Subpackages
- optimism.phasefield package
- Subpackages
- optimism.phasefield.test package
- Submodules
- optimism.phasefield.test.plotPhaseFieldThresholdModel module
- optimism.phasefield.test.plotSandiaModelUniaxial module
- optimism.phasefield.test.test_PhaseFieldLorentzPlastic module
- optimism.phasefield.test.test_PhaseFieldLorentzPlasticPatch module
- optimism.phasefield.test.test_PhaseFieldThreshold module
- optimism.phasefield.test.test_PhaseFieldThresholdPatch module
- optimism.phasefield.test.test_PhaseFieldThresholdPlastic module
- optimism.phasefield.test.test_PhaseFieldUniaxial module
- Module contents
- optimism.phasefield.test package
- Submodules
- optimism.phasefield.MaterialPointSimulator module
MaterialPointSimulator
UniaxialOutput
UniaxialOutput._asdict()
UniaxialOutput._field_defaults
UniaxialOutput._fields
UniaxialOutput._make()
UniaxialOutput._replace()
UniaxialOutput.energyHistory
UniaxialOutput.internalVariableHistory
UniaxialOutput.kirchhoffStressHistory
UniaxialOutput.phaseHistory
UniaxialOutput.strainHistory
UniaxialOutput.stressHistory
UniaxialOutput.times
- optimism.phasefield.PhaseField module
PhaseFieldFunctions
PhaseFieldFunctions._asdict()
PhaseFieldFunctions._field_defaults
PhaseFieldFunctions._fields
PhaseFieldFunctions._make()
PhaseFieldFunctions._replace()
PhaseFieldFunctions.compute_block_diagonal_element_stiffnesses
PhaseFieldFunctions.compute_constraint_hessian
PhaseFieldFunctions.compute_element_stiffnesses
PhaseFieldFunctions.compute_initial_state
PhaseFieldFunctions.compute_internal_energy
PhaseFieldFunctions.compute_output_energy_densities_and_fluxes
PhaseFieldFunctions.compute_phase_potential_energy
PhaseFieldFunctions.compute_strain_energy_densities
PhaseFieldFunctions.compute_updated_internal_variables
_compute_block_diagonal_element_stiffnesses()
_compute_element_stiffnesses()
axisymmetric_element_gradient_transformation()
axisymmetric_gradient()
compute_element_stiffness_from_global_fields()
compute_phase_field_constraint_hessian()
create_phasefield_functions()
energy_density_to_lagrangian_density()
plane_strain_element_gradient_transformation()
plane_strain_gradient()
unpack_fields_2D()
unpack_gradients_2D()
- optimism.phasefield.PhaseFieldClassic module
- optimism.phasefield.PhaseFieldLorentzPlastic module
_compute_elastic_linear_strain()
_compute_elastic_logarithmic_strain()
compute_elastic_linear_strain()
compute_elastic_logarithmic_strain()
compute_free_energy_density()
compute_state_increment()
compute_state_new_finite_deformations()
compute_state_new_small_deformations()
create_material_model_functions()
degradation()
dr()
elastic_deviatoric_free_energy()
elastic_volumetric_free_energy()
energy_density_generic()
incremental_potential()
make_initial_state_finite_deformations()
make_initial_state_small_deformations()
make_properties()
phase_potential_density()
r()
r_and_deqps()
strain_energy_density()
update_state()
- optimism.phasefield.PhaseFieldMaterialModel module
MaterialModel
MaterialModel._asdict()
MaterialModel._field_defaults
MaterialModel._fields
MaterialModel._make()
MaterialModel._replace()
MaterialModel.compute_energy_density
MaterialModel.compute_initial_state
MaterialModel.compute_output_energy_density
MaterialModel.compute_phase_potential_density
MaterialModel.compute_state_new
MaterialModel.compute_strain_energy_density
- optimism.phasefield.PhaseFieldThreshold module
- optimism.phasefield.PhaseFieldThresholdPlastic module
Properties
compute_elastic_strain()
compute_element_energy()
compute_state_increment()
compute_state_new()
compute_total_energy()
degradation()
dr()
dr_dstrain_and_deqps()
elastic_deviatoric_free_energy()
elastic_volumetric_free_energy()
energy_density()
energy_density_generic()
flow_stress()
hardening_energy_density()
incremental_potential()
interpolate_element_kinematics()
interpolate_kinematics()
make_initial_state()
make_properties()
phase_potential_density()
r()
r_and_deqps()
strain_energy_density()
update_state()
- Module contents
- Subpackages
- optimism.test package
- Submodules
- optimism.test.ConvexityPlot module
- optimism.test.MeshFixture module
- optimism.test.TestFixture module
- optimism.test.test_AxisymmPatchTest module
- optimism.test.test_DofManager module
- optimism.test.test_EquationSolver module
EquationSolverFixture
EquationSolverFixture._classSetupFailed
EquationSolverFixture._class_cleanups
EquationSolverFixture.setUp()
EquationSolverFixture.test_trust_region_equation_solver()
EquationSolverFixture.test_trust_region_incremental_optimizer()
EquationSolverFixture.test_trust_region_optimizer()
EquationSolverFixture.test_trust_region_optimizer_with_preconditioned_inner_products()
energy()
- optimism.test.test_FunctionSpace module
ParameterizationTestSuite
TestFunctionSpaceFixture
TestFunctionSpaceMultiQuadPointFixture
TestFunctionSpaceMultiQuadPointFixture._classSetupFailed
TestFunctionSpaceMultiQuadPointFixture._class_cleanups
TestFunctionSpaceMultiQuadPointFixture.setUp()
TestFunctionSpaceMultiQuadPointFixture.test_element_volume_multi_point_quadrature()
TestFunctionSpaceMultiQuadPointFixture.test_integrate_constant_field_multi_point_quadrature()
TestFunctionSpaceMultiQuadPointFixture.test_integrate_linear_field_multi_point_quadrature()
TestFunctionSpaceMultiQuadPointFixture.test_integrate_over_half_block()
TestFunctionSpaceMultiQuadPointFixture.test_integrate_over_half_block_indices()
TestFunctionSpaceMultiQuadPointFixture.test_jit_and_jacrev_on_integration()
TestFunctionSpaceMultiQuadPointFixture.test_jit_on_integration()
TestFunctionSpaceMultiQuadPointFixture.test_linear_reproducing_multi_point_quadrature()
TestFunctionSpaceSingleQuadPointFixture
TestFunctionSpaceSingleQuadPointFixture._classSetupFailed
TestFunctionSpaceSingleQuadPointFixture._class_cleanups
TestFunctionSpaceSingleQuadPointFixture.setUp()
TestFunctionSpaceSingleQuadPointFixture.test_element_volume_single_point_quadrature()
TestFunctionSpaceSingleQuadPointFixture.test_integrate_constant_field_single_point_quadrature()
TestFunctionSpaceSingleQuadPointFixture.test_integrate_linear_field_single_point_quadrature()
TestFunctionSpaceSingleQuadPointFixture.test_linear_reproducing_single_point_quadrature()
- optimism.test.test_Interpolants module
TestBubbleInterpolants
TestInterpolants
TestInterpolants._classSetupFailed
TestInterpolants._class_cleanups
TestInterpolants.no_test_plot_high_order_nodes()
TestInterpolants.setUp()
TestInterpolants.test_1D_element_element_topological_nodesets()
TestInterpolants.test_1D_interpolant_points_in_element()
TestInterpolants.test_grad_interpolation()
TestInterpolants.test_interpolation()
TestInterpolants.test_shape_kronecker_delta_property()
TestInterpolants.test_tri_element_element_topological_nodesets()
TestInterpolants.test_tri_face_nodes_match_1D_lobatto_nodes()
TestInterpolants.test_tri_interpolant_points_in_element()
TestInterpolants.test_tri_shapeGrads_partition_of_unity()
TestInterpolants.test_tri_shape_partition_of_unity()
generate_random_points_in_triangle()
- optimism.test.test_JaxConfig module
- optimism.test.test_LinAlg module
TestLinAlg
TestLinAlg._classSetupFailed
TestLinAlg._class_cleanups
TestLinAlg.setUp()
TestLinAlg.test_logm_iss_derivatives_on_double_degenerate_eigenvalues()
TestLinAlg.test_logm_iss_derivatives_on_triple_degenerate_eigenvalues()
TestLinAlg.test_logm_iss_fwd_mode_derivative()
TestLinAlg.test_logm_iss_hessian_on_double_degenerate_eigenvalues()
TestLinAlg.test_logm_iss_jit()
TestLinAlg.test_logm_iss_on_10x10()
TestLinAlg.test_logm_iss_on_double_degenerate_eigenvalues()
TestLinAlg.test_logm_iss_on_full_3x3s()
TestLinAlg.test_logm_iss_on_matrix_near_identity()
TestLinAlg.test_logm_iss_on_triple_degenerate_eigvalues()
TestLinAlg.test_logm_iss_rev_mode_derivative()
TestLinAlg.test_sqrtm()
TestLinAlg.test_sqrtm_derivatives_on_10x10()
TestLinAlg.test_sqrtm_fwd_mode_derivative()
TestLinAlg.test_sqrtm_jit()
TestLinAlg.test_sqrtm_on_10x10()
TestLinAlg.test_sqrtm_on_degenerate_eigenvalues()
TestLinAlg.test_sqrtm_rev_mode_derivative()
generate_n_random_symmetric_matrices()
- optimism.test.test_Math module
TestMathInnerProduct
TestMathInnerProduct._classSetupFailed
TestMathInnerProduct._class_cleanups
TestMathInnerProduct.setUp()
TestMathInnerProduct.test_dot2_on_ill_conditioned_inner_product()
TestMathInnerProduct.test_grad_on_dot2_works()
TestMathInnerProduct.test_jit_dot2_on_ill_conditioned_inner_product()
TestMathInnerProduct.test_numpy_dot_fails_badly_on_ill_conditioned_inner_product()
TestMathSum
- optimism.test.test_Mechanics module
- optimism.test.test_Mesh module
TestSingleMeshFixture
TestSingleMeshFixture._classSetupFailed
TestSingleMeshFixture._class_cleanups
TestSingleMeshFixture.setUp()
TestSingleMeshFixture.test_conversion_to_quadratic_mesh_is_valid()
TestSingleMeshFixture.test_create_nodesets_from_sidesets()
TestSingleMeshFixture.test_edge_connectivities()
TestSingleMeshFixture.test_edge_to_neighbor_cells_data()
triangle_inradius()
- optimism.test.test_MinimizeScalar module
TestMinimizeScalarFixture
TestMinimizeScalarFixture._classSetupFailed
TestMinimizeScalarFixture._class_cleanups
TestMinimizeScalarFixture.notest_grad()
TestMinimizeScalarFixture.notest_jit()
TestMinimizeScalarFixture.notest_stiff_problem()
TestMinimizeScalarFixture.setUp()
TestMinimizeScalarFixture.test_does_not_converge_to_saddle_point()
TestMinimizeScalarFixture.test_solves_quadratic_problem_in_one_iteration()
df()
f()
- optimism.test.test_Newmark module
DynamicPatchTest
DynamicsFixture
DynamicsFixture._classSetupFailed
DynamicsFixture._class_cleanups
DynamicsFixture.constant_body_force_potential()
DynamicsFixture.create_field()
DynamicsFixture.get_ubcs()
DynamicsFixture.setUp()
DynamicsFixture.set_initial_conditions()
DynamicsFixture.test_compute_kinetic_energy()
DynamicsFixture.test_hessian_matrix_is_symmetric()
DynamicsFixture.test_integration_of_constant_acceleration_is_exact()
DynamicsFixture.test_integration_of_rigid_motion_is_exact()
DynamicsFixture.test_potential()
DynamicsFixture.time_step()
- optimism.test.test_Objective module
TestObjective
TestObjective._classSetupFailed
TestObjective._class_cleanups
TestObjective.test_param_change()
TestObjective.test_param_change_first_out_of_two()
TestObjective.test_param_change_four_out_of_four()
TestObjective.test_param_change_second_out_of_three()
TestObjective.test_param_change_third_out_of_four()
- optimism.test.test_PatchTest module
LinearPatchTestLinearElements
LinearPatchTestQuadraticElements
LinearPatchTestQuadraticElements._classSetupFailed
LinearPatchTestQuadraticElements._class_cleanups
LinearPatchTestQuadraticElements.setUp()
LinearPatchTestQuadraticElements.test_dirichlet_patch_test_with_quadratic_elements()
LinearPatchTestQuadraticElements.test_dirichlet_patch_test_with_quadratic_elements_and_constant_jac_projection()
QuadraticPatchTestQuadraticElements
- optimism.test.test_PatchTestPou module
- optimism.test.test_QuadratureRule module
TestQuadratureRules
TestQuadratureRules._classSetupFailed
TestQuadratureRules._class_cleanups
TestQuadratureRules.endpoints
TestQuadratureRules.max_degree_1D
TestQuadratureRules.max_degree_2D
TestQuadratureRules.test_1D_quadrature_exactness()
TestQuadratureRules.test_1D_quadrature_points_in_domain()
TestQuadratureRules.test_1D_quadrature_weight_positivity()
TestQuadratureRules.test_triangle_quadrature_exactness()
TestQuadratureRules.test_triangle_quadrature_points_in_domain()
TestQuadratureRules.test_triangle_quadrature_weight_positivity()
are_inside_unit_interval()
are_positive_weights()
integrate_2D_monomial_on_triangle()
integrate_monomial_on_line()
is_inside_triangle()
map_1d_jac()
map_affine_1D()
- optimism.test.test_ReadExodusMesh module
TestMeshReadData
TestMeshReadData._classSetupFailed
TestMeshReadData._class_cleanups
TestMeshReadData.setUp()
TestMeshReadData.test_all_sets_named()
TestMeshReadData.test_block_maps()
TestMeshReadData.test_block_maps_no_map()
TestMeshReadData.test_entity_counts()
TestMeshReadData.test_node_set_sizes()
TestMeshReadData.test_side_set_sizes()
TestMeshReadPatchTest
TestMeshReadPropertiesTest
- optimism.test.test_ReadMesh module
- optimism.test.test_ScalarRootFinder module
ScalarRootFindTestFixture
ScalarRootFindTestFixture._classSetupFailed
ScalarRootFindTestFixture._class_cleanups
ScalarRootFindTestFixture.setUp()
ScalarRootFindTestFixture.test_find_root()
ScalarRootFindTestFixture.test_find_root_converges_on_hard_function()
ScalarRootFindTestFixture.test_find_root_with_forced_bisection_step()
ScalarRootFindTestFixture.test_find_root_with_jit()
ScalarRootFindTestFixture.test_root_find_is_differentiable()
ScalarRootFindTestFixture.test_root_find_with_vmap_and_jit()
ScalarRootFindTestFixture.test_solves_when_left_bracket_is_solution()
ScalarRootFindTestFixture.test_solves_when_right_bracket_is_solution()
ScalarRootFindTestFixture.test_unbracketed_root_gives_nan()
f()
- optimism.test.test_SmoothFunctions module
- optimism.test.test_SparseMatrix module
- optimism.test.test_SparsePreconditioner module
SparseCholeskyFixture
SparseCholeskyFixture._classSetupFailed
SparseCholeskyFixture._class_cleanups
SparseCholeskyFixture.precond_update_func()
SparseCholeskyFixture.setUp()
SparseCholeskyFixture.test_diagonal_backup_preconditioner()
SparseCholeskyFixture.test_indefinite_fixed_by_shift()
SparseCholeskyFixture.test_multiply_by_transpose()
SparseCholeskyFixture.test_sparse_solve()
SparseCholeskyFixture.test_sparse_solve_and_update()
- optimism.test.test_Surface module
TestSingleMeshFixture
TestSingleMeshFixture._classSetupFailed
TestSingleMeshFixture._class_cleanups
TestSingleMeshFixture.disable_test_edge_conn()
TestSingleMeshFixture.setUp()
TestSingleMeshFixture.test_integrate_function_on_surface_that_uses_coords_and_normal()
TestSingleMeshFixture.test_integrate_perimeter()
TestSingleMeshFixture.test_integrate_quadratic_fn_on_surface()
- optimism.test.test_TensorMath module
TensorMathFixture
TensorMathFixture._classSetupFailed
TensorMathFixture._class_cleanups
TensorMathFixture.setUp()
TensorMathFixture.test_determinant()
TensorMathFixture.test_determinant_precision()
TensorMathFixture.test_detpIm1()
TensorMathFixture.test_eigen_sym33_non_unit()
TensorMathFixture.test_eigen_sym33_non_unit_degenerate_case()
TensorMathFixture.test_exp_symm_at_identity()
TensorMathFixture.test_exp_symm_double_eigs()
TensorMathFixture.test_exp_symm_gradient_distinct_eigenvalues()
TensorMathFixture.test_exp_symm_gradient_double_eigs()
TensorMathFixture.test_exp_symm_gradient_scaled_identity()
TensorMathFixture.test_exp_symm_scaled_identity()
TensorMathFixture.test_log_symm_double_eigs()
TensorMathFixture.test_log_symm_gradient_almost_double_degenerate()
TensorMathFixture.test_log_symm_gradient_distinct_eigenvalues()
TensorMathFixture.test_log_symm_gradient_double_eigs()
TensorMathFixture.test_log_symm_gradient_scaled_identity()
TensorMathFixture.test_log_symm_scaled_identity()
TensorMathFixture.test_pow_symm_double_eigs()
TensorMathFixture.test_pow_symm_gradient_almost_double_degenerate()
TensorMathFixture.test_pow_symm_gradient_distinct_eigenvalues()
TensorMathFixture.test_pow_symm_gradient_double_eigs()
TensorMathFixture.test_pow_symm_gradient_scaled_identity()
TensorMathFixture.test_pow_symm_scaled_identity()
TensorMathFixture.test_right_polar_decomp()
TensorMathFixture.test_sqrt_symm()
TensorMathFixture.test_sqrt_symm_double_eigs()
TensorMathFixture.test_sqrt_symm_gradient_almost_double_degenerate()
TensorMathFixture.test_sqrt_symm_gradient_distinct_eigenvalues()
TensorMathFixture.test_sqrt_symm_gradient_double_eigs()
TensorMathFixture.test_sqrt_symm_gradient_scaled_identity()
TensorMathFixture.test_sqrt_symm_scaled_identity()
numerical_grad()
- optimism.test.test_Traction module
- optimism.test.test_TrustRegionSPG module
TRSPGCauchyPointFixture
TRSPGCauchyPointFixture._classSetupFailed
TRSPGCauchyPointFixture._class_cleanups
TRSPGCauchyPointFixture.no_test_trust_region_equation_solver()
TRSPGCauchyPointFixture.setUp()
TRSPGCauchyPointFixture.test_cauchy_point_obeys_constraints()
TRSPGCauchyPointFixture.test_cauchy_point_stays_inside_trust_region()
TRSPGCauchyPointFixture.test_cauchy_point_with_active_constraints_achieves_sufficient_decrease()
TRSPGCauchyPointFixture.test_forward_track_search_of_cp_step_length_achieves_sufficient_decrease()
TRSPGCauchyPointFixture.test_projection()
TRSPGCauchyPointFixture.test_unconstrained_cauchy_point_achieves_sufficient_decrease()
TestProjectionOnBoundary
TestSubproblemSolveFixture
TestTrustRegionSPGFixture
TestTrustRegionSPGRosenbrock
energy()
quadratic()
rosenbrock()
- optimism.test.test_VTKWriter module
TestVTKWriter
TestVTKWriterHigherOrder
TestVTKWriterHigherOrder._classSetupFailed
TestVTKWriterHigherOrder._class_cleanups
TestVTKWriterHigherOrder.baseFileName
TestVTKWriterHigherOrder.make_high_order_writer_with_fields()
TestVTKWriterHigherOrder.setUp()
TestVTKWriterHigherOrder.tearDown()
TestVTKWriterHigherOrder.test_vtk_writer_no_inconsistent_sizes_with_cubic_elements()
TestVTKWriterHigherOrder.test_vtk_writer_no_inconsistent_sizes_with_quadratic_elements()
TestVTKWriterHigherOrder.test_vtk_writer_on_cubic_elements()
TestVTKWriterHigherOrder.test_vtk_writer_on_quadratic_elements()
- optimism.test.test_VolumeAverageJ module
TestVolumeAverage
TestVolumeAverage._classSetupFailed
TestVolumeAverage._class_cleanups
TestVolumeAverage.setUp()
TestVolumeAverage.test_constant_J_projection_exact_for_constant_J_field()
TestVolumeAverage.test_constant_J_projection_inexact_for_linear_J_field()
TestVolumeAverage.test_linear_J_projection_exact_for_constant_J_field()
TestVolumeAverage.test_linear_J_projection_exact_for_linear_J_field()
TestVolumeAverage.test_linear_J_projection_inexact_for_quadratic_J_field()
- Module contents
Submodules
optimism.AlSolver module
- class optimism.AlSolver.Settings(penalty_scaling, target_constraint_decrease_factor, relative_gmres_tol, max_gmres_iters, use_second_order_update, use_newton_only, num_initial_low_order_iterations, inverse_ncp_hessian_bound, max_al_iters, tol)
Bases:
tuple
- _asdict()
Return a new dict which maps field names to their values.
- _field_defaults = {}
- _fields = ('penalty_scaling', 'target_constraint_decrease_factor', 'relative_gmres_tol', 'max_gmres_iters', 'use_second_order_update', 'use_newton_only', 'num_initial_low_order_iterations', 'inverse_ncp_hessian_bound', 'max_al_iters', 'tol')
- classmethod _make(iterable)
Make a new Settings object from a sequence or iterable
- _replace(**kwds)
Return a new Settings object replacing specified fields with new values
- inverse_ncp_hessian_bound
Alias for field number 7
- max_al_iters
Alias for field number 8
- max_gmres_iters
Alias for field number 3
- num_initial_low_order_iterations
Alias for field number 6
- penalty_scaling
Alias for field number 0
- relative_gmres_tol
Alias for field number 2
- target_constraint_decrease_factor
Alias for field number 1
- tol
Alias for field number 9
- use_newton_only
Alias for field number 5
- use_second_order_update
Alias for field number 4
- optimism.AlSolver.augmented_lagrange_solve(alObjective, x, p, alSettings, subSettings, callback=None, sub_problem_callback=None, sub_problem_solver=<function trust_region_minimize>, useWarmStart=True, updatePrecond=True, updatePrecondBeforeWarmStart=True)[source]
optimism.BoundConstrainedObjective module
- class optimism.BoundConstrainedObjective.BoundConstrainedObjective(objective_func, x0, p, constrainedIndices, constraintStiffnessScaling=1.0, precondStrategy=None)[source]
Bases:
ConstrainedObjective
optimism.BoundConstrainedSolver module
optimism.ConstrainedObjective module
- class optimism.ConstrainedObjective.ConstrainedObjective(objective_func, constraint_func, x, p, lam, kappa, precondStrategy=None)[source]
Bases:
Objective
- class optimism.ConstrainedObjective.ConstrainedQuasiObjective(objective_func, constraint_func, x, p, lam, kappa, precondStrategy=None)[source]
Bases:
ConstrainedObjective
optimism.EquationSolver module
- class optimism.EquationSolver.Settings(t1, t2, eta1, eta2, eta3, max_trust_iters, tol, max_cg_iters, max_cumulative_cg_iters, cg_tol, cg_inexact_solve_ratio, tr_size, min_tr_size, check_stability, use_preconditioned_inner_product_for_cg, use_incremental_objective, debug_info, over_iters)
Bases:
tuple
- _asdict()
Return a new dict which maps field names to their values.
- _field_defaults = {}
- _fields = ('t1', 't2', 'eta1', 'eta2', 'eta3', 'max_trust_iters', 'tol', 'max_cg_iters', 'max_cumulative_cg_iters', 'cg_tol', 'cg_inexact_solve_ratio', 'tr_size', 'min_tr_size', 'check_stability', 'use_preconditioned_inner_product_for_cg', 'use_incremental_objective', 'debug_info', 'over_iters')
- classmethod _make(iterable)
Make a new Settings object from a sequence or iterable
- _replace(**kwds)
Return a new Settings object replacing specified fields with new values
- cg_inexact_solve_ratio
Alias for field number 10
- cg_tol
Alias for field number 9
- check_stability
Alias for field number 13
- debug_info
Alias for field number 16
- eta1
Alias for field number 2
- eta2
Alias for field number 3
- eta3
Alias for field number 4
- max_cg_iters
Alias for field number 7
- max_cumulative_cg_iters
Alias for field number 8
- max_trust_iters
Alias for field number 5
- min_tr_size
Alias for field number 12
- over_iters
Alias for field number 17
- t1
Alias for field number 0
- t2
Alias for field number 1
- tol
Alias for field number 6
- tr_size
Alias for field number 11
- use_incremental_objective
Alias for field number 15
- use_preconditioned_inner_product_for_cg
Alias for field number 14
- optimism.EquationSolver.get_settings(t1=0.25, t2=1.75, eta1=1e-10, eta2=0.1, eta3=0.5, max_trust_iters=100, tol=1e-08, max_cg_iters=50, max_cumulative_cg_iters=1000, cg_tol=None, cg_inexact_solve_ratio=1e-05, tr_size=2.0, min_tr_size=1e-08, check_stability=False, use_preconditioned_inner_product_for_cg=False, use_incremental_objective=False, debug_info=True, over_iters=0)[source]
- optimism.EquationSolver.is_converged(objective, x, realO, modelO, realRes, modelRes, cgIters, trSize, settings)[source]
- optimism.EquationSolver.nonlinear_equation_solve(objective, x0, p, settings, solver_algorithm=<function trust_region_minimize>, callback=None, useWarmStart=True, updatePrecond=True)[source]
- optimism.EquationSolver.preconditioned_project_to_boundary(z, d, trSize, zz, mult_by_approx_hessian)[source]
- optimism.EquationSolver.print_banner(objective, modelObjective, cgIters, trSize, onBoundary, willAccept)[source]
- optimism.EquationSolver.print_min_banner(objective, modelObjective, res, modelRes, cgIters, trSize, onBoundary, willAccept, settings)[source]
optimism.EquationSolverSubspace module
- optimism.EquationSolverSubspace.spectral_gradient_minimize(x, g, hess_vec_func, trSize, settings)[source]
optimism.FunctionSpace module
- class optimism.FunctionSpace.DofManager(functionSpace, dim, EssentialBCs)[source]
Bases:
Module
- HessColCoords: any
- HessRowCoords: any
- _abc_impl = <_abc._abc_data object>
- bcIndices: any
- dofToUnknown: any
- fieldShape: Tuple[int, int]
- hessian_bc_mask: any
- ids: any
- isBc: any
- isUnknown: any
- unknownIndices: any
- class optimism.FunctionSpace.EssentialBC(nodeSet: str, component: int)[source]
Bases:
Module
- _abc_impl = <_abc._abc_data object>
- component: int
- nodeSet: str
- class optimism.FunctionSpace.FunctionSpace(shapes: Float[Array, 'ne nqpe nn'], vols: Float[Array, 'ne nqpe'], shapeGrads: Float[Array, 'ne nqpe nn nd'], mesh: Mesh, quadratureRule: QuadratureRule, isAxisymmetric: bool)[source]
Bases:
Module
Data needed for calculus on functions in the discrete function space.
In describing the shape of the attributes,
ne
is the number of elements in the mesh,nqpe
is the number of quadrature points per element,npe
is the number of nodes per element, andnd
is the spatial dimension of the domain.- shapes
Shape function values on each element, shape (ne, nqpe, npe)
- Type:
jaxtyping.Float[Array, ‘ne nqpe nn’]
- vols
Volume attributed to each quadrature point. That is, the quadrature weight (on the parameteric element domain) multiplied by the Jacobian determinant of the map from the parent element to the element in the domain. Shape (ne, nqpe).
- Type:
jaxtyping.Float[Array, ‘ne nqpe’]
- shapeGrads
Derivatives of the shape functions with respect to the spatial coordinates of the domain. Shape (ne, nqpe, npe, nd).
- Type:
jaxtyping.Float[Array, ‘ne nqpe nn nd’]
- mesh
The
Mesh
object of the domain.- Type:
- quadratureRule
The
QuadratureRule
on which to sample the shape functions.
- isAxisymmetric
boolean indicating if the function space data are axisymmetric.
- Type:
bool
- _abc_impl = <_abc._abc_data object>
- isAxisymmetric: bool
- quadratureRule: QuadratureRule
- shapeGrads: Float[Array, 'ne nqpe nn nd']
- shapes: Float[Array, 'ne nqpe nn']
- vols: Float[Array, 'ne nqpe']
- optimism.FunctionSpace.compute_element_field_gradient(U, coords, elemShapes, elemShapeGrads, elemVols, elemConnectivity, modify_element_gradient)[source]
- optimism.FunctionSpace.compute_element_volumes(coordField, nodeOrdinals, parentElement, shapes, weights)[source]
- optimism.FunctionSpace.compute_element_volumes_axisymmetric(coordField, nodeOrdinals, parentElement, shapes, weights)[source]
- optimism.FunctionSpace.compute_field_gradient(functionSpace, nodalField, modify_element_gradient=<function default_modify_element_gradient>)[source]
- optimism.FunctionSpace.construct_function_space(mesh, quadratureRule, mode2D='cartesian')[source]
Construct a discrete function space.
- Parameters:
mesh (The mesh of the domain.)
quadratureRule (The quadrature rule to be used for integrating on the) – domain.
mode2D (A string indicating how the 2D domain is interpreted for) – integration. Valid values are
cartesian
andaxisymmetric
. Axisymetric mode will include the factor of 2*pi*r in thevols
attribute.
- Return type:
The
FunctionSpace
object.
- optimism.FunctionSpace.construct_function_space_from_parent_element(mesh, shapeOnRef, quadratureRule, mode2D='cartesian')[source]
Construct a function space with precomputed shape function data on the parent element.
This version of the function space constructor is Jax-transformable, and in particular can be jitted. The computation of the shape function values and derivatives on the parent element is not transformable in general. However, the mapping of the shape function data to the elements in the mesh is transformable. One can precompute the parent element shape functions once and for all, and then use this special factory function to construct the function space and avoid the non-transformable part of the operation. The primary use case is for shape sensitivities: the coordinates of the mesh change, and we want Jax to pick up the sensitivities of the shape function derivatives in space to the coordinate changes (which occurs through the mapping from the parent element to the spatial domain).
- Parameters:
mesh (The mesh of the domain.)
shapeOnRef (A tuple of the shape function values and gradients on the) – parent element, evaluated at the quadrature points. The caller must take care to ensure the shape functions are evaluated at the same points as contained in the
quadratureRule
parameter.quadratureRule (The quadrature rule to be used for integrating on the) – domain.
mode2D (A string indicating how the 2D domain is interpreted for) – integration. See the default factory function for details.
- Return type:
The
FunctionSpace
object.
- optimism.FunctionSpace.construct_weighted_function_space(mesh, quadratureRule, quadratureWeights=1.0)[source]
- optimism.FunctionSpace.default_modify_element_gradient(elemGrads, elemShapes, elemVols, elemNodalDisps, elemNodalCoords)[source]
- optimism.FunctionSpace.evaluate_on_block(functionSpace, U, stateVars, dt, func, block, *params, modify_element_gradient=<function default_modify_element_gradient>)[source]
Evaluates a density function at every quadrature point in a block of the mesh.
- Parameters:
functionSpace – Function space object to do the evaluation with.
U – The vector of dofs for the primal field in the functional.
stateVars – Internal state variable array.
dt – Current time increment
func – Lagrangian density function to evaluate, Must have the signature
func(u, dudx, q, x, *params) -> scalar
, whereu
is the primal field,q
is the value of the internal variables,x
is the current point coordinates, and*params
is a variadic set of additional parameters, which correspond to the*params
argument.block – Group of elements to evaluate over. This is an array of element indices. For performance, the elements within the block should be numbered consecutively.
*params – Optional parameter fields to pass into Lagrangian density function. These are represented as a single value per element.
modify_element_gradient – Optional function that modifies the gradient at the element level. This can be to set the particular 2D mode, and additionally to enforce volume averaging on the gradient operator. This is a keyword-only argument.
- Returns:
An array of shape (numElements, numQuadPtsPerElement) that contains the scalar values of the density functional
func
at every quadrature point in the block.
- optimism.FunctionSpace.evaluate_on_element(U, coords, elemStates, dt, elemShapes, elemShapeGrads, elemVols, elemConn, kernelFunc, modify_element_gradient, *params)[source]
- optimism.FunctionSpace.get_nodal_values_on_edge(functionSpace, nodalField, edge)[source]
Get nodal values of a field on an element edge.
Arguments: functionSpace: a FunctionSpace object nodalField: The nodal vector defined over the mesh (shape is number of
nodes by number of field components)
- edge: tuple containing the element number containing the edge and the
permutation (0, 1, or 2) of the edge within the triangle
- optimism.FunctionSpace.integrate_element(U, coords, elemStates, elemShapes, elemShapeGrads, elemVols, elemConn, func, modify_element_gradient)[source]
- optimism.FunctionSpace.integrate_element_from_local_field(elemNodalField, elemNodalCoords, elemStates, dt, elemShapes, elemShapeGrads, elemVols, func, modify_element_gradient=<function default_modify_element_gradient>)[source]
Integrate over element with element nodal field as input. This allows element residuals and element stiffness matrices to computed.
- optimism.FunctionSpace.integrate_function_on_edges(functionSpace, func, U, quadRule, edges)[source]
- optimism.FunctionSpace.integrate_over_block(functionSpace, U, stateVars, dt, func, block, *params, modify_element_gradient=<function default_modify_element_gradient>)[source]
Integrates a density function over a block of the mesh.
- Parameters:
functionSpace – Function space object to do the integration with.
U – The vector of dofs for the primal field in the functional.
stateVars – Internal state variable array.
dt – Current time increment
func – Lagrangian density function to integrate, Must have the signature
func(u, dudx, q, x, *params) -> scalar
, whereu
is the primal field,q
is the value of the internal variables,x
is the current point coordinates, and*params
is a variadic set of additional parameters, which correspond to the*params
argument.block – Group of elements to integrate over. This is an array of element indices. For performance, the elements within the block should be numbered consecutively.
*params – Optional parameter fields to pass into Lagrangian density function. These are represented as a single value per element.
modify_element_gradient – Optional function that modifies the gradient at the element level. This can be to set the particular 2D mode, and additionally to enforce volume averaging on the gradient operator. This is a keyword-only argument.
- Returns:
A scalar value for the integral of the density functional
func
integrated over the block of elements.
- optimism.FunctionSpace.interpolate_nodal_field_on_edge(functionSpace, U, interpolationPoints, edge)[source]
Interpolate a nodal field to specified points on an element edge.
Arguments: functionSpace: a FunctionSpace object U: the nodal values array interpolationPoints: coordinates of points (in the 1D parametric space) to
interpolate to
- edge: tuple containing the element number containing the edge and the
permutation (0, 1, or 2) of the edge within the triangle
optimism.IncompleteCholesky module
optimism.Interpolants module
- class optimism.Interpolants.ParentElement(elementType: int, degree: int, coordinates: Float[Array, 'nn nd'], vertexNodes: Int[Array, 'nn'], faceNodes: Int[Array, 'nf nnpf'], interiorNodes: Int[Array, 'ni'])[source]
Bases:
Module
Finite element on reference domain.
- elementType
integer indiacting the element type. The magic numbers are defined in the
Interpolants
module.- Type:
int
- degree
Highest degree complete polynomial the element is capable of exactly representing.
- Type:
int
- coordinates
Locations of the nodes in parameteric coordinates. Rows are nodes, columns are x and y.
- Type:
jaxtyping.Float[Array, ‘nn nd’]
- vertexNodes
Indices of vertices in the
coordinates
array.- Type:
jaxtyping.Int[Array, ‘nn’]
- faceNodes
Indices of the nodes on each triangle face in the
coordinates
array. For example,faceNodes[0]
gives the indices of the nodes on the face between vertex 0 and vertex 1. This is empty for line elements.- Type:
jaxtyping.Int[Array, ‘nf nnpf’]
- interiorNodes
Indices of nodes that are not on the boundary of the element.
- Type:
jaxtyping.Int[Array, ‘ni’]
- _abc_impl = <_abc._abc_data object>
- coordinates: Float[Array, 'nn nd']
- degree: int
- elementType: int
- faceNodes: Int[Array, 'nf nnpf']
- interiorNodes: Int[Array, 'ni']
- property num_nodes
- vertexNodes: Int[Array, 'nn']
- class optimism.Interpolants.ShapeFunctions(values: Float[Array, 'nq nn'], gradients: Float[Array, 'nq nn nd'])[source]
Bases:
Module
Shape functions and shape function gradients (in the parametric space).
- values
Values of the shape functions at a discrete set of points. Shape is
(nPts, nNodes)
, wherenPts
is the number of points at which the shame functinos are evaluated, andnNodes
is the number of nodes in the element (which is equal to the number of shape functions).- Type:
jaxtyping.Float[Array, ‘nq nn’]
- gradients
Values of the parametric gradients of the shape functions. Shape is
(nPts, nDim, nNodes)
, wherenDim
is the number of spatial dimensions. Line elements are an exception, which have shape(nPts, nNdodes)
.- Type:
jaxtyping.Float[Array, ‘nq nn nd’]
- _abc_impl = <_abc._abc_data object>
- gradients: Float[Array, 'nq nn nd']
- values: Float[Array, 'nq nn']
- optimism.Interpolants.make_parent_element_1d(degree)[source]
Gauss-Lobatto Interpolation points on the unit interval.
- optimism.Interpolants.make_parent_element_2d(degree)[source]
Interpolation points on the triangle that are Lobatto points on the edges. Points have threefold rotational symmetry and low Lebesgue constants.
Reference: M.G. Blyth and C. Pozrikidis. “A Lobatto interpolation grid over the triangle” IMA Journal of Applied Mathematics (2005) 1-17. doi:10.1093/imamat/hxh077
Convention for numbering: example: degree = 3
3 o | 6 o o 2 interior node is 5 | 8 o o o 1 | o–o–o–o 9 7 4 0
- optimism.Interpolants.make_parent_elements(degree)[source]
Returns a triangle element and the corresponding line element.
- optimism.Interpolants.shape1d(degree, nodalPoints, evaluationPoints)[source]
Evaluate shape functions and derivatives at points in the master element.
- Parameters:
master1d – 1D MasterElement to evaluate the shape function data on
evaluationPoints – Array of points in the master element domain at which to evaluate the shape functions and derivatives.
- Returns:
Shape function values and shape function derivatives at
evaluationPoints
, in a tuple (shape
,dshape
). shapes: [nNodes, nEvalPoints] dshapes: [nNodes, nEvalPoints]
optimism.J2PlasticPhaseField module
- optimism.J2PlasticPhaseField.dr_dstrain_and_deqps(elasticTrialStrain, eqps, eqpsOld, props)
Jacobian of incremental_potential with respect to positional argument(s) (0, 1). Takes the same arguments as incremental_potential but returns the jacobian of the output with respect to the arguments at positions (0, 1).
- optimism.J2PlasticPhaseField.incremental_potential(elasticTrialStrain, eqps, eqpsOld, props)[source]
- optimism.J2PlasticPhaseField.r(elasticTrialStrain, eqps, eqpsOld, props)
Jacobian of incremental_potential with respect to positional argument(s) 1. Takes the same arguments as incremental_potential but returns the jacobian of the output with respect to the arguments at positions 1.
- optimism.J2PlasticPhaseField.r_and_deqps(elasticTrialStrain, eqps, eqpsOld, props)
Value and gradient of incremental_potential with respect to positional argument(s) 1. Takes the same arguments as incremental_potential but returns a two-element tuple where the first element is the value of incremental_potential and the second element is the gradient, which has the same shape as the arguments at positions 1.
optimism.JaxConfig module
optimism.LU module
optimism.LinAlg module
- optimism.LinAlg._logm_iss(A)[source]
Logarithmic map by inverse scaling and squaring and Padé approximants
Translated from the Matrix Function Toolbox http://www.ma.man.ac.uk/~higham/mftoolbox Nicholas J. Higham, Functions of Matrices: Theory and Computation, SIAM, Philadelphia, PA, USA, 2008. ISBN 978-0-898716-46-7,
- optimism.LinAlg.log_pade_pf(A, n)[source]
Logarithmic map by Padé approximant and partial fractions
- optimism.LinAlg.sqrtm_dbp(A)[source]
Matrix square root by product form of Denman-Beavers iteration.
Translated from the Matrix Function Toolbox http://www.ma.man.ac.uk/~higham/mftoolbox Nicholas J. Higham, Functions of Matrices: Theory and Computation, SIAM, Philadelphia, PA, USA, 2008. ISBN 978-0-898716-46-7,
optimism.Math module
- optimism.Math.dot2(x, y)[source]
Compute inner product of 2 vectors to much higher accuracy than numpy.dot.
- Parameters:
x (ndarray, with only one axis (shape [n,]))
y (ndarray, with only one axis (shape [n,]))
- Returns:
dotprod – The inner product of the input vectors.
- Return type:
real
This special inner product method computes the result as accurate as if computed in quadruple precision. This algorithm is useful to computing objective functions from numerical integration. It avoids accumulation of floating point cancellation error that can obscure whether an objective function has truly decreased.
- The environment variable setting
‘XLA_FLAGS = “–xla_cpu_enable_fast_math=false”’
is critical for this function to work on the CPU. Otherwise, xla apparently sets a flag for LLVM that allows unsafe floating point optimizations that can change associativity.
Reference: T. Ogita, S. M. Rump, and S. Oishi. Accurate sum and dot product. SIAM J. Sci. Comput., Vol 26, No 6, pp. 1955-1988. doi: 10.1137/030601818
- optimism.Math.sum2(a)[source]
Sum a vector to much higher accuracy than numpy.sum.
- Parameters:
a (ndarray, with only one axis (shape [n,]))
- Returns:
sum – The sum of the numbers in the array
- Return type:
real
This special sum method computes the result as accurate as if computed in quadruple precision.
Reference: T. Ogita, S. M. Rump, and S. Oishi. Accurate sum and dot product. SIAM J. Sci. Comput., Vol 26, No 6, pp. 1955-1988. doi: 10.1137/030601818
optimism.Mechanics module
- class optimism.Mechanics.DynamicsFunctions(compute_algorithmic_energy: Callable, compute_updated_internal_variables: Callable, compute_element_hessians: Callable, compute_output_energy_densities_and_stresses: Callable, compute_output_kinetic_energy: Callable, compute_output_strain_energy: Callable, compute_initial_state: Callable, compute_element_masses: Callable, predict: Callable, correct: Callable)[source]
Bases:
Module
- _abc_impl = <_abc._abc_data object>
- compute_algorithmic_energy: Callable
- compute_element_hessians: Callable
- compute_element_masses: Callable
- compute_initial_state: Callable
- compute_output_energy_densities_and_stresses: Callable
- compute_output_kinetic_energy: Callable
- compute_output_strain_energy: Callable
- compute_updated_internal_variables: Callable
- correct: Callable
- predict: Callable
- class optimism.Mechanics.MechanicsFunctions(compute_strain_energy: Callable, compute_updated_internal_variables: Callable, compute_element_stiffnesses: Callable, compute_output_energy_densities_and_stresses: Callable, compute_initial_state: Callable, integrated_material_qoi: Callable, compute_output_material_qoi: Callable)[source]
Bases:
Module
- _abc_impl = <_abc._abc_data object>
- compute_element_stiffnesses: Callable
- compute_initial_state: Callable
- compute_output_energy_densities_and_stresses: Callable
- compute_output_material_qoi: Callable
- compute_strain_energy: Callable
- compute_updated_internal_variables: Callable
- integrated_material_qoi: Callable
- class optimism.Mechanics.NewmarkParameters(gamma: float = 0.5, beta: float = 0.25)[source]
Bases:
Module
- _abc_impl = <_abc._abc_data object>
- beta: float = 0.25
- gamma: float = 0.5
- optimism.Mechanics._compute_element_masses(functionSpace, U, internals, density, modify_element_gradient)[source]
- optimism.Mechanics._compute_element_stiffnesses(U, internals, dt, functionSpace, compute_energy_density, modify_element_gradient)[source]
- optimism.Mechanics._compute_element_stiffnesses_multi_block(U, stateVariables, dt, functionSpace, blockModels, modify_element_gradient)[source]
- optimism.Mechanics._compute_newmark_element_hessians(functionSpace, U, UPredicted, internals, density, dt, newmarkBeta, strain_energy_density, modify_element_gradient)[source]
- optimism.Mechanics._compute_strain_energy(functionSpace, UField, stateField, dt, compute_energy_density, modify_element_gradient)[source]
- optimism.Mechanics._compute_strain_energy_multi_block(functionSpace, UField, stateField, dt, blockModels, modify_element_gradient)[source]
- optimism.Mechanics._compute_updated_internal_variables(functionSpace, U, states, dt, compute_state_new, modify_element_gradient)[source]
- optimism.Mechanics._compute_updated_internal_variables_multi_block(functionSpace, U, states, dt, blockModels, modify_element_gradient)[source]
- optimism.Mechanics.axisymmetric_element_gradient_transformation(elemDispGrads, elemShapes, elemVols, elemNodalDisps, elemNodalCoords)[source]
- optimism.Mechanics.compute_element_stiffness_from_global_fields(U, coords, elInternals, dt, elConn, elShapes, elShapeGrads, elVols, lagrangian_density, modify_element_gradient)[source]
- optimism.Mechanics.compute_newmark_lagrangian(functionSpace, U, UPredicted, internals, density, dt, newmarkBeta, strain_energy_density, modify_element_gradient)[source]
- optimism.Mechanics.compute_traction_potential_energy(fs, U, quadRule, edges, load)[source]
Compute potential energy of surface tractions.
Arguments: fs: a FunctionSpace object U: the nodal displacements quadRule: the 1D quadrature rule to use for the integration edges: array of edges, each row is an edge. Each edge has two entries, the
element ID, and the permutation of that edge in the triangle (0, 1, 2).
- load: Callable that returns the traction vector. The signature is
load(X, n), where X is coordinates of a material point, and n is the outward unit normal.
time: current time
- optimism.Mechanics.create_dynamics_functions(functionSpace, mode2D, materialModel, newmarkParameters, pressureProjectionDegree=None)[source]
- optimism.Mechanics.create_mechanics_functions(functionSpace, mode2D, materialModel, pressureProjectionDegree=None)[source]
- optimism.Mechanics.create_multi_block_mechanics_functions(functionSpace, mode2D, materialModels, pressureProjectionDegree=None)[source]
- optimism.Mechanics.define_pressure_projection_gradient_tranformation(pressureProjectionDegree, modify_element_gradient)[source]
optimism.Mesh module
- class optimism.Mesh.Mesh(coords, conns, simplexNodesOrdinals, parentElement, parentElement1d, blocks=None, nodeSets=None, sideSets=None, block_maps=None)
Bases:
tuple
Triangle mesh representing a domain.
- coords
Coordinates of the nodes, shape
(nNodes, nDim)
.
- conns
Nodal connectivity table of the elements.
- simplexNodesOrdinals
Indices of the nodes that are vertices.
- parentElement
A
ParentElement
that is the element type in parametric space. A mesh can contain only 1 element type.
- parentElement1d
- blocks
A dictionary mapping element block names to the indices of the elements in the block.
- nodeSets
A dictionary mapping node set names to the indices of the nodes.
- sideSets
A dictionary mapping side set names to the edges. The edge data structure is a tuple of the element index and the local number of the edge within that element. For example, triangle elements will have edge 0, 1, or 2 for this entry.
- block_maps
An optional dictionary mapping element block names to global element ID maps that may be present in the mesh.
- _asdict()
Return a new dict which maps field names to their values.
- _field_defaults = {'block_maps': None, 'blocks': None, 'nodeSets': None, 'sideSets': None}
- _fields = ('coords', 'conns', 'simplexNodesOrdinals', 'parentElement', 'parentElement1d', 'blocks', 'nodeSets', 'sideSets', 'block_maps')
- classmethod _make(iterable)
Make a new Mesh object from a sequence or iterable
- _replace(**kwds)
Return a new Mesh object replacing specified fields with new values
- block_maps
Alias for field number 8
- blocks
Alias for field number 5
- conns
Alias for field number 1
- coords
Alias for field number 0
- nodeSets
Alias for field number 6
- parentElement
Alias for field number 3
- parentElement1d
Alias for field number 4
- sideSets
Alias for field number 7
- simplexNodesOrdinals
Alias for field number 2
- optimism.Mesh.compute_edge_vectors(mesh: Mesh, edgeCoords)[source]
Get geometric vectors for an element edge.
Assumes that the edgs has a constant shape jacobian, that is, the transformation from the parent element is affine.
Arguments: mesh: a Mesh object edgeCoords: coordinates of all nodes on the edge, in the order
defined by the 1D parent element convention
Returns: tuple (t, n, j) with t: the unit tangent vector n: the outward unit normal vector j: jacobian of the transformation from parent to physical space
- optimism.Mesh.construct_mesh_from_basic_data(coords, conns, blocks, nodeSets=None, sideSets=None)[source]
- optimism.Mesh.construct_structured_mesh(Nx, Ny, xExtent, yExtent, elementOrder=1, useBubbleElement=False)[source]
- optimism.Mesh.create_edges(conns)[source]
Generate topological information about edges in a triangulation.
- Parameters:
conns ((nTriangles, 3) array) – Connectivity table of the triangulation.
- Returns:
edgeConns ((nEdges, 2) array) – Vertices of each edge. Boundary edges are always in the counter-clockwise sense, so that the interior of the body is on the left side when walking from the first vertex to the second.
edges ((nEdges, 4) array) – Edge-to-triangle topological information. Each row provides the follwing information for each edge: [leftT, leftP, rightT, rightP], where leftT is the ID of the triangle to the left, leftP is the permutation of the edge in the left triangle (edge 0, 1, or 2), rightT is the ID of the triangle to the right, and rightP is the permutation of the edge in the right triangle. If the edge is a boundary edge, the values of rightT and rightP are -1.
- optimism.Mesh.create_higher_order_mesh_from_simplex_mesh(mesh, order, useBubbleElement=False, copyNodeSets=False, createNodeSetsFromSideSets=False)[source]
optimism.MeshPlot module
optimism.MinimizeScalar module
- class optimism.MinimizeScalar.Settings(tol, max_iters)
Bases:
tuple
- _asdict()
Return a new dict which maps field names to their values.
- _field_defaults = {}
- _fields = ('tol', 'max_iters')
- classmethod _make(iterable)
Make a new Settings object from a sequence or iterable
- _replace(**kwds)
Return a new Settings object replacing specified fields with new values
- max_iters
Alias for field number 1
- tol
Alias for field number 0
optimism.NewtonSolver module
- class optimism.NewtonSolver.Settings(relative_gmres_tol, max_gmres_iters)
Bases:
tuple
- _asdict()
Return a new dict which maps field names to their values.
- _field_defaults = {}
- _fields = ('relative_gmres_tol', 'max_gmres_iters')
- classmethod _make(iterable)
Make a new Settings object from a sequence or iterable
- _replace(**kwds)
Return a new Settings object replacing specified fields with new values
- max_gmres_iters
Alias for field number 1
- relative_gmres_tol
Alias for field number 0
optimism.Objective module
- class optimism.Objective.Params(bc_data, state_data, design_data, app_data, time, dynamic_data)
Bases:
tuple
- _asdict()
Return a new dict which maps field names to their values.
- _field_defaults = {'app_data': None, 'bc_data': None, 'design_data': None, 'dynamic_data': None, 'state_data': None, 'time': None}
- _fields = ('bc_data', 'state_data', 'design_data', 'app_data', 'time', 'dynamic_data')
- classmethod _make(iterable)
Make a new Params object from a sequence or iterable
- _replace(**kwds)
Return a new Params object replacing specified fields with new values
- app_data
Alias for field number 3
- bc_data
Alias for field number 0
- design_data
Alias for field number 2
- dynamic_data
Alias for field number 5
- state_data
Alias for field number 1
- time
Alias for field number 4
- class optimism.Objective.ScaledObjective(objective_func, x0, p, precondStrategy=None)[source]
Bases:
Objective
- class optimism.Objective.ScaledPrecondStrategy(precondStrategy, dofScaling)[source]
Bases:
PrecondStrategy
- class optimism.Objective.TwoTryPrecondStrategy(f1, f2)[source]
Bases:
PrecondStrategy
optimism.QuadratureRule module
- class optimism.QuadratureRule.QuadratureRule(xigauss: Float[Array, 'nq 2'], wgauss: Float[Array, 'nq'])[source]
Bases:
Module
Quadrature rule points and weights. An
equinox
Module
containingxigauss
, ajax.numpy
array of the coordinates of the sample points in the reference domain, andwgauss
, ajax.numpy
array with the weights.- _abc_impl = <_abc._abc_data object>
- wgauss: Float[Array, 'nq']
- xigauss: Float[Array, 'nq 2']
- optimism.QuadratureRule.create_padded_quadrature_rule_1D(degree)[source]
Creates 1D Gauss quadrature rule data that are padded to maintain a uniform size, which makes this function jit-able.
This function is inteded to be used only when jit compilation of calls to the quadrature rules are needed. Otherwise, prefer to use the standard quadrature rules. The standard rules do not contain extra 0s for padding, which makes them more efficient when used repeatedly (such as in the global energy).
- Parameters:
degree – degree of highest polynomial to be integrated exactly
- optimism.QuadratureRule.create_quadrature_rule_1D(degree)[source]
Creates a Gauss-Legendre quadrature on the unit interval.
The rule can exactly integrate polynomials of degree up to
degree
.- Parameters:
degree (Highest degree polynomial to be exactly integrated by the quadrature rule)
- Returns:
A
QuadratureRule
named tuple containing the quadrature point coordinatesand the weights.
- optimism.QuadratureRule.create_quadrature_rule_on_triangle(degree)[source]
Creates a Gauss-Legendre quadrature on the unit triangle.
The rule can exactly integrate 2D polynomials up to the value of
degree
. The domain is the triangle between the vertices (0, 0)-(1, 0)-(0, 1). The rules here are guaranteed to be cyclically symmetric in triangular coordinates and to have strictly positive weights.- Parameters:
degree (Highest degree polynomial to be exactly integrated by the quadrature rule)
- Returns:
A
QuadratureRule
named tuple containing the quadrature point coordinatesand the weights.
optimism.ReadExodusMesh module
optimism.ReadMesh module
optimism.ScalarRootFind module
- class optimism.ScalarRootFind.Settings(max_iters, x_tol, r_tol)
Bases:
tuple
- _asdict()
Return a new dict which maps field names to their values.
- _field_defaults = {}
- _fields = ('max_iters', 'x_tol', 'r_tol')
- classmethod _make(iterable)
Make a new Settings object from a sequence or iterable
- _replace(**kwds)
Return a new Settings object replacing specified fields with new values
- max_iters
Alias for field number 0
- r_tol
Alias for field number 2
- x_tol
Alias for field number 1
- class optimism.ScalarRootFind.SolutionInfo(converged, iterations, function_calls, residual_norm, correction_norm)
Bases:
tuple
- _asdict()
Return a new dict which maps field names to their values.
- _field_defaults = {}
- _fields = ('converged', 'iterations', 'function_calls', 'residual_norm', 'correction_norm')
- classmethod _make(iterable)
Make a new SolutionInfo object from a sequence or iterable
- _replace(**kwds)
Return a new SolutionInfo object replacing specified fields with new values
- converged
Alias for field number 0
- correction_norm
Alias for field number 4
- function_calls
Alias for field number 2
- iterations
Alias for field number 1
- residual_norm
Alias for field number 3
- optimism.ScalarRootFind.find_root(f, x0, bracket, settings)[source]
Find a root of a nonlinear scalar-valued equation.
Uses Newton’s method, safeguarded with bisection. See rtsafe(…) from Numerical Recipes. This function is differentiable using Jax transforms, and can be compsed with vmap and jit.
- Parameters:
f (callable) – Scalar function of which to find a root.
x0 (real) – Initial guess for root. The value of x0 should be within the range defined by bracket. If not, the initial guess will be automatically clipped to the nearest bound.
bracket (sequence of 2 reals (list, tuple, numpy array, etc)) – Upper and lower bounds for the root search. The existence of a root is inferred by checking that the values of f at both brackets do not have the same sign. If this check fails, nan is returned.
settings (A settings object from this module) – Algorithmic settings.
- Returns:
x – Argument of f such that f(x) = 0 (within provided tolerance). If the root is not bracketed, nan is returned.
- Return type:
real (or nan)
- optimism.ScalarRootFind.get_settings(max_iters=50, x_tol=1e-13, r_tol=0)[source]
Get numerical settings for the root finder.
- Parameters:
max_iters (int) – Maximum number of iterations to use in search
x_tol (real) – Tolerance on independent variable for convergence. The root finder will terminate when the independent variable changes by less than x_tol in an iteration.
r_tol (real) – Tolerance on absolute value of residual for convergence.
- Returns:
settings
- Return type:
A Settings object, which can be used in find_root.
optimism.SmoothFunctions module
optimism.SparseCholesky module
optimism.SparseMatrixAssembler module
optimism.Surface module
optimism.TensorMath module
Provide differentiable operations on 3x3 tensors.
- optimism.TensorMath._symmetric_matrix_function_jvp_helper(func, relative_difference, primals, tangents)[source]
- optimism.TensorMath.detpIm1(A)[source]
Compute det(A + I) - 1 while preserving precision when A is small compared to the identity.
- optimism.TensorMath.eigen_sym33_non_unit(tensor)[source]
Compute eigen values and vectors of a symmetric 3x3 tensor.
Note, returned eigen vectors may not be unit length Note, this routine involves high powers of the input tensor (~M^8). Thus results can start to denormalize when the infinity norm of the input tensor falls outside the range 1.0e-40 to 1.0e+40. Outside this range use eigen_sym33_unit
- optimism.TensorMath.log_sqrt_symm(A)[source]
Compute matrix logarithm of the square root of a symmetric positive definite matrix.
- optimism.TensorMath.right_polar_decomposition(F)[source]
Compute the right polar decomposition of a tensor.
Computes the factors R and U such that R@U = F, where R is an orthogonal matrix and U is symmetric positive semi-definite.
Parameters: F : 3x3 matrix
- Returns: a tuple of the following arrays
R : orthogonal matrix U : right stretch matrix
optimism.Timer module
- class optimism.Timer.Timer(name: str | None = None, text: str = 'Time in {name}: {:0.8f} seconds', logger: ~typing.Callable[[str], None] | None = <built-in function print>)[source]
Bases:
ContextDecorator
Time your code using a class, context manager, or decorator
- _start_time: float | None = None
- logger()
print(value, …, sep=’ ‘, end=’n’, file=sys.stdout, flush=False)
Prints the values to a stream, or to sys.stdout by default. Optional keyword arguments: file: a file-like object (stream); defaults to the current sys.stdout. sep: string inserted between values, default a space. end: string appended after the last value, default a newline. flush: whether to forcibly flush the stream.
- name: str | None = None
- text: str = 'Time in {name}: {:0.8f} seconds'
- timers: ClassVar[Dict[str, float]] = {}
optimism.TrustRegionSPG module
- class optimism.TrustRegionSPG.Settings(t1, t2, eta1, eta2, eta3, max_trust_iters, tol, max_spg_iters, max_cumulative_spg_iters, spg_tol, spg_inexact_solve_ratio, tr_size, min_tr_size, check_stability, use_preconditioned_inner_product_for_spg, spg_use_nonmonotone, spg_nonmonotone_iter_limit_to_enforce_decrease, use_incremental_objective, cauchy_point_sufficient_decrease_factor, cauchy_point_decrease_tol, cauchy_point_max_line_search_iters, min_spectral_step_length, max_spectral_step_length, debug_info)
Bases:
tuple
- _asdict()
Return a new dict which maps field names to their values.
- _field_defaults = {}
- _fields = ('t1', 't2', 'eta1', 'eta2', 'eta3', 'max_trust_iters', 'tol', 'max_spg_iters', 'max_cumulative_spg_iters', 'spg_tol', 'spg_inexact_solve_ratio', 'tr_size', 'min_tr_size', 'check_stability', 'use_preconditioned_inner_product_for_spg', 'spg_use_nonmonotone', 'spg_nonmonotone_iter_limit_to_enforce_decrease', 'use_incremental_objective', 'cauchy_point_sufficient_decrease_factor', 'cauchy_point_decrease_tol', 'cauchy_point_max_line_search_iters', 'min_spectral_step_length', 'max_spectral_step_length', 'debug_info')
- classmethod _make(iterable)
Make a new Settings object from a sequence or iterable
- _replace(**kwds)
Return a new Settings object replacing specified fields with new values
- cauchy_point_decrease_tol
Alias for field number 19
- cauchy_point_max_line_search_iters
Alias for field number 20
- cauchy_point_sufficient_decrease_factor
Alias for field number 18
- check_stability
Alias for field number 13
- debug_info
Alias for field number 23
- eta1
Alias for field number 2
- eta2
Alias for field number 3
- eta3
Alias for field number 4
- max_cumulative_spg_iters
Alias for field number 8
- max_spectral_step_length
Alias for field number 22
- max_spg_iters
Alias for field number 7
- max_trust_iters
Alias for field number 5
- min_spectral_step_length
Alias for field number 21
- min_tr_size
Alias for field number 12
- spg_inexact_solve_ratio
Alias for field number 10
- spg_nonmonotone_iter_limit_to_enforce_decrease
Alias for field number 16
- spg_tol
Alias for field number 9
- spg_use_nonmonotone
Alias for field number 15
- t1
Alias for field number 0
- t2
Alias for field number 1
- tol
Alias for field number 6
- tr_size
Alias for field number 11
- use_incremental_objective
Alias for field number 17
- use_preconditioned_inner_product_for_spg
Alias for field number 14
- optimism.TrustRegionSPG.bound_constrained_trust_region_minimize(objective, x, bounds, settings, callback=None)[source]
- optimism.TrustRegionSPG.find_generalized_cauchy_point(x, g, hess_vec_func, bounds, alpha, trSize, settings)[source]
- optimism.TrustRegionSPG.get_settings(t1=0.25, t2=1.75, eta1=1e-10, eta2=0.1, eta3=0.5, max_trust_iters=100, tol=1e-08, max_spg_iters=25, max_cumulative_spg_iters=1000, spg_tol=None, spg_inexact_solve_ratio=0.0001, tr_size=2.0, min_tr_size=1e-08, check_stability=False, use_preconditioned_inner_product_for_spg=False, spg_use_nonmonotone=True, spg_nonmonotone_iter_limit_to_enforce_decrease=10, use_incremental_objective=False, cauchy_point_sufficient_decrease_factor=0.0001, cauchy_point_decrease_tol=1e-08, cauchy_point_max_line_search_iters=25, min_spectral_step_length=1e-12, max_spectral_step_length=1000000000000.0, debug_info=True)[source]
Must have spg_tol < tol to avoid inexactness of subproblem solves preventing convergence of trust region algorithm.
- optimism.TrustRegionSPG.is_converged(objective, x, realO, modelO, realOptimality, modelOptimality, spgIters, trSize, settings)[source]
- optimism.TrustRegionSPG.print_min_banner(objective, modelObjective, res, modelRes, spgIters, trSize, onBoundary, willAccept, settings)[source]
- optimism.TrustRegionSPG.project_onto_tr(x, xk, bounds, trSize)[source]
Projects onto intersection of feasible set and trust region boundary.
- optimism.TrustRegionSPG.solve(objective, x0, p, lowerBounds, upperBounds, settings, callback=None, useWarmStart=True, updatePrecond=True)[source]
optimism.VTKWriter module
- class optimism.VTKWriter.VTKDataType(value)[source]
Bases:
Enum
An enumeration.
- BIT = 'bit'
- CHAR = 'char'
- DOUBLE = 'double'
- FLOAT = 'float'
- INT = 'int'
- LONG = 'long'
- SHORT = 'short'
- UNSIGNED_CHAR = 'unsigned_char'
- UNSIGNED_INT = 'unsigned_int'
- UNSIGNED_LONG = 'unsigned_long'
- UNSIGNED_SHORT = 'unsigned_short'
- class optimism.VTKWriter.VTKFieldType(value)[source]
Bases:
Enum
An enumeration.
- SCALARS = 1
- TENSORS = 3
- VECTORS = 2
- class optimism.VTKWriter.VTKWriter(mesh, baseFileName='output')[source]
Bases:
object
- class VTKFieldRecord(data, fieldType, dataType)
Bases:
tuple
- _asdict()
Return a new dict which maps field names to their values.
- _field_defaults = {}
- _fields = ('data', 'fieldType', 'dataType')
- classmethod _make(iterable)
Make a new VTKFieldRecord object from a sequence or iterable
- _replace(**kwds)
Return a new VTKFieldRecord object replacing specified fields with new values
- data
Alias for field number 0
- dataType
Alias for field number 2
- fieldType
Alias for field number 1